当我尝试将Firebase
集成到我的应用中时,我遇到了问题。
以前的情况,谷歌分析,谷歌地图,谷歌推送与我的应用程序运作良好。由于谷歌发布Firebase
并集成了所有工具和一些新工具,我想用Firebase替换它们。
替换google-services.json
并修改模块和项目的build.gradle
后,编译就可以了。但是当我尝试记录事件时,我收到此错误日志:
12-01 16:10:47.571 V/FA (30278): onActivityCreated
12-01 16:10:47.654 W/FA (30278): Failed to invoke Tag Manager's initialize() method: java.lang.reflect.InvocationTargetException: com.google.android.gms.measurement.internal.zzac.zzg(Unknown Source)
12-01 16:10:47.655 D/FA (30278): Logging event (FE): eventName, Bundle[{_o=app, IMEI=354110070069074, SerialNumber=SerialNumber, LenovoId=LenovoId}]
12-01 16:10:47.657 V/FA (30278): State of service unknown
12-01 16:10:47.657 V/FA (30278): Checking service availability
12-01 16:10:47.657 E/FA (30278): Task exception on worker thread: java.lang.IllegalStateException: A required meta-data tag in your app's AndroidManifest.xml does not exist. You must have the following declaration within the <application> element: <meta-data android:name="com.google.android.gms.version" android:value="@integer/google_play_services_version" />: com.google.android.gms.measurement.internal.zzad.zzbyb(Unknown Source)
12-01 16:10:47.658 V/FA (30278): Activity paused, time: 509442340
12-01 16:10:47.805 V/FA (30278): Activity resumed, time: 509442608
事实上,我的AndroidManifest.xml文件中已存在元数据:
<meta-data
android:name="com.google.android.gms.version"
android:value="@integer/google_play_services_version" />
由于Analytics,Map和Push之一需要它,因此之前添加了它。