IllegalStateException:应用程序中的元数据标记';s AndroidManifest.xml没有正确的值
将gradle build tools更新到3.6.3后,我在尝试获取以前没有的广告ID时遇到运行时崩溃 AndroidManifest.xmlIllegalStateException:应用程序中的元数据标记';s AndroidManifest.xml没有正确的值,android,google-play-services,android-manifest,Android,Google Play Services,Android Manifest,将gradle build tools更新到3.6.3后,我在尝试获取以前没有的广告ID时遇到运行时崩溃 AndroidManifest.xml <meta-data tools:replace="android:value" android:name="com.google.android.gms.version" android:value="@integer/gms_version" /> Lo
<meta-data
tools:replace="android:value"
android:name="com.google.android.gms.version"
android:value="@integer/gms_version" />
Logcat
Caused by: java.lang.IllegalStateException: The meta-data tag in your app's AndroidManifest.xml does not have the right value. Expected 12451000 but found 6587000. 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" />
at com.google.android.gms.common.GooglePlayServicesUtilLight.isGooglePlayServicesAvailable(com.google.android.gms:play-services-basement@@17.2.1:19)
at com.google.android.gms.common.GoogleApiAvailabilityLight.isGooglePlayServicesAvailable(com.google.android.gms:play-services-basement@@17.2.1:5)
at com.google.android.gms.ads.identifier.AdvertisingIdClient.zza(Unknown Source:17)
at com.google.android.gms.ads.identifier.AdvertisingIdClient.zza(Unknown Source:17)
at com.google.android.gms.ads.identifier.AdvertisingIdClient.getAdvertisingIdInfo(Unknown Source:47)
原因:java.lang.IllegalStateException:应用程序的AndroidManifest.xml中的元数据标记没有正确的值。预计为12451000,但发现为6587000。元素中必须有以下声明:
在com.google.android.gms.common.GooglePlayServicesUtilLight.isGooglePlayServicesAvailable上(com.google.android.gms:play services Basic@@17.2.1:19)
在com.google.android.gms.common.GooglePaiAvailabilityLight.isGooglePlayServicesAvailable上(com.google.android.gms:play services Basic@@17.2.1:5)
在com.google.android.gms.ads.identifier.advisingidclient.zza(未知来源:17)
在com.google.android.gms.ads.identifier.advisingidclient.zza(未知来源:17)
在com.google.android.gms.ads.identifier.AdvertisingIdClient.getAdvertisingIdInfo(未知来源:47)
如果我将鼠标悬停在values.xml中的“google\u play\u services\u version”上,它会显示多个实现。一个是版本“12451000”,来自gms:play-services-basec-17.2.1,另一个是内部库,包含在aar文件中。它包含google play服务版本“6587000”。我想这就是冲突发生的地方
如果我在values.xml中将值硬编码为“12451000”,则错误已修复,但除了硬编码之外,还有其他解决方案吗 像这样更改它,并确保它位于您的
标签中
<meta-data
android:name="com.google.android.gms.version"
android:value="@integer/gms_version" />
您还可以在values.xml
文件中提供直接值。像这样,
12451000
如果您不想硬编码它,那么您可以删除.jar
文件。如果您在build.gradle中添加了依赖项,那么您不需要在其中包含.jar
文件
让我知道它是否能帮助你
谢谢,祝你快乐 Pranav:元数据标记已经在应用程序标记下。我已经提到,如果我直接给出我不想给出的值,它会很好地工作。寻找一个动态的解决方案。未获取remove.jar注释。我使用的是一个.aar库文件,它使用的是google play服务版本6587000。提前谢谢。
Caused by: java.lang.IllegalStateException: The meta-data tag in your app's AndroidManifest.xml does not have the right value. Expected 12451000 but found 6587000. 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" />
at com.google.android.gms.common.GooglePlayServicesUtilLight.isGooglePlayServicesAvailable(com.google.android.gms:play-services-basement@@17.2.1:19)
at com.google.android.gms.common.GoogleApiAvailabilityLight.isGooglePlayServicesAvailable(com.google.android.gms:play-services-basement@@17.2.1:5)
at com.google.android.gms.ads.identifier.AdvertisingIdClient.zza(Unknown Source:17)
at com.google.android.gms.ads.identifier.AdvertisingIdClient.zza(Unknown Source:17)
at com.google.android.gms.ads.identifier.AdvertisingIdClient.getAdvertisingIdInfo(Unknown Source:47)
<meta-data
android:name="com.google.android.gms.version"
android:value="@integer/gms_version" />