Firebase成功初始化后,“ java.lang.IllegalStateException:AppMeasurement未初始化”调用FirebaseAnalytics

时间:2019-02-06 20:03:28

标签: android firebase unity3d

按照所有指导步骤进行操作后,如何在iOS和Android上使用Unity Plugin设置Firebase 5.4.4,仍然无法在Android上运行。 Firebase控制台未收到该应用程序的任何回调或事件,但该应用程序似乎已正确配置。该项目是使用Unity 2018.3.0f2开发的。

该项目使用的是Firebase插件版本5.4.3,并且我已更新为5.4.4,结果相同。另外,我尝试再次删除并重新安装Firebase插件(全新安装),但没有成功。

一切似乎都已正确连接,并且在Firebase控制台中,Android项目看起来已完全配置(它已在iOS上正常运行)。另外,我尝试使用此处提供的快速启动应用(https://github.com/firebase/quickstart-unity)来显示相同​​的异常,并且在Firebase控制台上未收到任何事件。

看到设备上应用程序的日志,表明Firebase已正确初始化:

  

firebase:Firebase应用程序初始化应用程序xxx.xxxxxxxx.xxxxxx(默认为1)。   
Unity:Firebase应用初始化应用xxx.xxxxxxxx.xxxxxx(默认为1)。   
firebase:Firebase Analytics API初始化   
Unity:Firebase Analytics API初始化   
firebase:分析API已初始化   
Unity:已初始化Analytics API

但是在尝试使用FirebaseAnalytics发送指标后,日志显示了下一个异常:

  

E FA:工作程序
上的任务异常:java.lang.IllegalStateException:未初始化AppMeasurement:com.google.android.gms.measurement.internal.zzbw.zzcl(未知源:289)

还有build.gradle文件:

// GENERATED BY UNITY. REMOVE THIS COMMENT TO PREVENT OVERWRITING WHEN EXPORTING AGAIN

buildscript {
    repositories {
        google()
		jcenter()
        
    }

    dependencies {
        classpath 'com.android.tools.build:gradle:3.0.1'
    }
}

allprojects {
    repositories {
        flatDir {
            dirs 'libs'
        }
    }
}

apply plugin: 'com.android.application'

dependencies {
    implementation fileTree(dir: 'libs', include: ['*.jar'])
    implementation(name: 'android.arch.lifecycle.runtime-1.0.0', ext:'aar')
    implementation(name: 'arcore_client', ext:'aar')
    implementation(name: 'ARExtensions', ext:'aar')
    implementation(name: 'com.android.support.animated-vector-drawable-26.1.0', ext:'aar')
    implementation(name: 'com.android.support.appcompat-v7-26.1.0', ext:'aar')
    implementation(name: 'com.android.support.cardview-v7-26.1.0', ext:'aar')
    implementation(name: 'com.android.support.customtabs-26.1.0', ext:'aar')
    implementation(name: 'com.android.support.support-compat-26.1.0', ext:'aar')
    implementation(name: 'com.android.support.support-core-ui-26.1.0', ext:'aar')
    implementation(name: 'com.android.support.support-core-utils-26.1.0', ext:'aar')
    implementation(name: 'com.android.support.support-fragment-26.1.0', ext:'aar')
    implementation(name: 'com.android.support.support-media-compat-26.1.0', ext:'aar')
    implementation(name: 'com.android.support.support-v4-26.1.0', ext:'aar')
    implementation(name: 'com.android.support.support-vector-drawable-26.1.0', ext:'aar')
    implementation(name: 'com.google.android.gms.play-services-ads-identifier-16.0.0', ext:'aar')
    implementation(name: 'com.google.android.gms.play-services-base-16.0.1', ext:'aar')
    implementation(name: 'com.google.android.gms.play-services-basement-16.0.1', ext:'aar')
    implementation(name: 'com.google.android.gms.play-services-measurement-api-16.0.4', ext:'aar')
    implementation(name: 'com.google.android.gms.play-services-measurement-base-16.0.5', ext:'aar')
    implementation(name: 'com.google.android.gms.play-services-stats-16.0.1', ext:'aar')
    implementation(name: 'com.google.android.gms.play-services-tasks-16.0.1', ext:'aar')
    implementation(name: 'com.google.firebase.firebase-analytics-16.0.6', ext:'aar')
    implementation(name: 'com.google.firebase.firebase-analytics-impl-16.2.4', ext:'aar')
    implementation(name: 'com.google.firebase.firebase-analytics-unity-5.4.4', ext:'aar')
    implementation(name: 'com.google.firebase.firebase-app-unity-5.4.4', ext:'aar')
    implementation(name: 'com.google.firebase.firebase-common-16.0.4', ext:'aar')
    implementation(name: 'com.google.firebase.firebase-core-16.0.6', ext:'aar')
    implementation(name: 'com.google.firebase.firebase-iid-17.0.4', ext:'aar')
    implementation(name: 'com.google.firebase.firebase-iid-interop-16.0.1', ext:'aar')
    implementation(name: 'com.google.firebase.firebase-measurement-connector-17.0.1', ext:'aar')
    implementation(name: 'com.google.firebase.firebase-measurement-connector-impl-17.0.4', ext:'aar')
    implementation(name: 'facebook-android-wrapper-7.13.0', ext:'aar')
    implementation(name: 'facebook-applinks', ext:'aar')
    implementation(name: 'facebook-common', ext:'aar')
    implementation(name: 'facebook-core', ext:'aar')
    implementation(name: 'facebook-login', ext:'aar')
    implementation(name: 'facebook-marketing', ext:'aar')
    implementation(name: 'facebook-messenger', ext:'aar')
    implementation(name: 'facebook-places', ext:'aar')
    implementation(name: 'facebook-share', ext:'aar')
    implementation(name: 'play-services-basement-11.0.4', ext:'aar')
    implementation(name: 'UnityAds', ext:'aar')
    implementation(name: 'unityandroidpermissions', ext:'aar')
    implementation(name: 'UnityARCore', ext:'aar')
    implementation project(':Firebase')
}

android {
    compileSdkVersion 28
    buildToolsVersion '28.0.3'

    defaultConfig {
        minSdkVersion 24
        targetSdkVersion 28
        applicationId 'xxxxx'
        ndk {
            abiFilters 'armeabi-v7a'
        }
        versionCode 2
        versionName '0.0.2'

		multiDexEnabled true
    }

    lintOptions {
        abortOnError false
    }

    aaptOptions {
        noCompress '.unity3d', '.ress', '.resource', '.obb', 'build_info.txt', 'google-services-desktop.json'
    }

    signingConfigs {
        release {
            storeFile file('xxxxxxxxx')
            storePassword 'xxxx'
            keyAlias 'xxxx'
            keyPassword 'xxxx'
        }
    }

    buildTypes {
        debug {
            minifyEnabled false
            useProguard false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-unity.txt'
            jniDebuggable true
        }
        release {
            minifyEnabled false
            useProguard false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-unity.txt'
            signingConfig signingConfigs.release
        }
    }

    packagingOptions {
        doNotStrip '*/armeabi-v7a/*.so'
    }

}

我已经在其他Unity项目中配置了Firebase,但现在我不知道它是问题的根源。

0 个答案:

没有答案