Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Firebase Android: App crash when receiving Notification after adding Invites

I'm using React Native to build an app that uses Firebase Messaging, Invites, etc. The app was running well until I added Firebase Invite/Links to the app. Now; even though the app can build and run, it will crash when it received a push notification. The logcat shows:

FATAL EXCEPTION: Firebase-RNFirebaseMessagingService
09-06 15:59:43.724 19077 19566 E AndroidRuntime: Process: com.myapp, PID: 19077
09-06 15:59:43.724 19077 19566 E AndroidRuntime: java.lang.NoSuchFieldError: No static field zzadc of type [Ljava/lang/String; in class Lcom/google/android/gms/measurement/AppMeasurement$UserProperty; or its superclasses (declaration of 'com.google.android.gms.measurement.AppMeasurement$UserProperty' appears in /data/app/com.myapp-1/base.apk)
09-06 15:59:43.724 19077 19566 E AndroidRuntime:    at com.google.firebase.analytics.connector.internal.zzb.<clinit>(Unknown Source)
09-06 15:59:43.724 19077 19566 E AndroidRuntime:    at com.google.firebase.analytics.connector.AnalyticsConnectorImpl.logEvent(Unknown Source)
09-06 15:59:43.724 19077 19566 E AndroidRuntime:    at com.google.firebase.messaging.zzb.zzc(Unknown Source)
09-06 15:59:43.724 19077 19566 E AndroidRuntime:    at com.google.firebase.messaging.zzb.zze(Unknown Source)
09-06 15:59:43.724 19077 19566 E AndroidRuntime:    at com.google.firebase.messaging.FirebaseMessagingService.zzd(Unknown Source)
09-06 15:59:43.724 19077 19566 E AndroidRuntime:    at com.google.firebase.iid.zzc.run(Unknown Source)
09-06 15:59:43.724 19077 19566 E AndroidRuntime:    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1113)
09-06 15:59:43.724 19077 19566 E AndroidRuntime:    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:588)
09-06 15:59:43.724 19077 19566 E AndroidRuntime:    at com.google.android.gms.common.util.concurrent.zza.run(Unknown Source)
09-06 15:59:43.724 19077 19566 E AndroidRuntime:    at java.lang.Thread.run(Thread.java:818)

I thought it was due to the methods amount surpassing the 65k limit and have uses multiDex and proguard but the result seems to be the same. Since the stack trace shows analytics; I've tried included Firebase Analytics as well, but also didn't work. Below is my build.gradle:

apply plugin: "com.android.application"

import com.android.build.OutputFile

project.ext.react = [
    entryFile: "index.js"
]

apply from: "../../node_modules/react-native/react.gradle"

def enableProguardInReleaseBuilds = true

android {
    compileSdkVersion 26
    buildToolsVersion "26.0.1"

    defaultConfig {
        applicationId "com.myapp"
        minSdkVersion 16
        targetSdkVersion 22
        versionCode 1
        versionName "1.0"
        multiDexEnabled true
        ndk {
            abiFilters "armeabi-v7a", "x86"
        }
    }
    splits {
        abi {
            reset()
            enable enableSeparateBuildPerCPUArchitecture
            universalApk false  // If true, also generate a universal APK
            include "armeabi-v7a", "x86"
        }
    }
    signingConfigs {
        release {
            if (project.hasProperty('MYAPP_RELEASE_STORE_FILE')) {
                storeFile file(MYAPP_RELEASE_STORE_FILE)
                storePassword MYAPP_RELEASE_STORE_PASSWORD
                keyAlias MYAPP_RELEASE_KEY_ALIAS
                keyPassword MYAPP_RELEASE_KEY_PASSWORD
            }
        }
    }
    buildTypes {
        release {
            minifyEnabled enableProguardInReleaseBuilds
            proguardFiles getDefaultProguardFile("proguard-android.txt"), "proguard-rules.pro"
            signingConfig signingConfigs.release
        }
        debug {
          minifyEnabled true
          proguardFiles getDefaultProguardFile("proguard-android.txt"), "proguard-rules.pro"
        }
    }
    // applicationVariants are e.g. debug, release
    applicationVariants.all { variant ->
        variant.outputs.each { output ->
            // For each separate APK per architecture, set a unique version code as described here:
            // http://tools.android.com/tech-docs/new-build-system/user-guide/apk-splits
            def versionCodes = ["armeabi-v7a":1, "x86":2]
            def abi = output.getFilter(OutputFile.ABI)
            if (abi != null) {  // null for the universal-debug, universal-release variants
                output.versionCodeOverride =
                        versionCodes.get(abi) * 1048576 + defaultConfig.versionCode
            }
        }
    }
}

dependencies {
    implementation project(':react-native-firebase')
    //For Firebase
    implementation "com.google.android.gms:play-services-base:15.0.1"
    implementation "com.google.firebase:firebase-core:16.0.0"
    implementation "com.google.firebase:firebase-auth:16.0.2"
    implementation "com.google.firebase:firebase-messaging:17.1.0"
    implementation "com.google.firebase:firebase-functions:16.0.1"
    implementation "com.google.firebase:firebase-invites:16.0.1"

    implementation project(':realm')
    implementation project(':react-native-pdf')
    implementation project(':react-native-fetch-blob')
    implementation (project(':react-native-camera')) {
        exclude group: "com.android.support"
    }
    implementation project(':react-native-image-picker')
    implementation project(':react-native-localization')
    implementation project(':react-native-fbsdk')
    implementation project(':react-native-linear-gradient')
    implementation fileTree(dir: "libs", include: ["*.jar"])
    implementation "com.android.support:appcompat-v7:23.0.1"
    implementation "com.facebook.react:react-native:+"  // From node_modules    

    implementation 'com.android.support:multidex:1.0.3'
}

// Run this once to be able to run the application with BUCK
// puts all compile dependencies into folder libs for BUCK to use
task copyDownloadableDepsToLibs(type: Copy) {
    from configurations.compile
    into 'libs'
}

apply plugin: 'com.google.gms.google-services'
com.google.gms.googleservices.GoogleServicesPlugin.config.disableVersionCheck = true

At this point, I'm not really sure how to handle this anymore. Anyone have this issue or idea?

like image 481
rabbit87 Avatar asked Sep 06 '18 08:09

rabbit87


1 Answers

Adding as answer : From one of my running project,

 // Firebase dependencies 
implementation 'com.google.firebase:firebase-invites:16.0.1' 
implementation "com.google.android.gms:play-services-base:15.0.1" 
implementation "com.google.android.gms:play-services-auth:16.0.0" 
implementation "com.google.firebase:firebase-core:16.0.1" 
implementation "com.google.firebase:firebase-auth:16.0.3" 
implementation "com.google.firebase:firebase-firestore:17.1.0" 
implementation "com.google.firebase:firebase-messaging:17.3.0"
like image 161
Nizam Avatar answered Oct 30 '22 08:10

Nizam