繁体   English   中英

Firebase Android:添加邀请后收到通知时应用崩溃

[英]Firebase Android: App crash when receiving Notification after adding Invites

我正在使用React Native构建一个使用Firebase Messaging,Invites等的应用程序。应用程序运行良好,直到我将Firebase Invite / Links添加到应用程序。 现在; 即使应用程序可以构建和运行,它也会在收到推送通知时崩溃。 logcat显示:

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)

我认为这是由于方法数量超过了65k的限制并且使用了multiDex和proguard但结果似乎是相同的。 由于堆栈跟踪显示分析; 我也尝试过包含Firebase Analytics,但也没有用。 下面是我的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

在这一点上,我不知道如何处理这个问题。 有人有这个问题或想法吗?

添加为答案:从我正在运行的项目中,

 // 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"

感谢Nizam的评论,我设法通过增加Firebase核心,身份验证和消息传递的版本来解决这个问题。 固定版本如下所示(gradle文件的其余部分是相同的):

implementation "com.google.android.gms:play-services-base:15.0.1"
implementation "com.google.firebase:firebase-core:16.0.1"
implementation "com.google.firebase:firebase-auth:16.0.3"
implementation "com.google.firebase:firebase-messaging:17.3.0"
implementation "com.google.firebase:firebase-functions:16.0.1"
implementation "com.google.firebase:firebase-invites:16.0.1"

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM