当前位置: 首页 > 面试题库 >

JavaGoogle Play服务更新至版本13后,出现错误

戚锦
2023-03-14
问题内容

如何解决此错误?

原因:java.lang.illegalargumentexception 11-01 11:08:12.845:E / AndroidRuntime(28885):原因:java.lang.IllegalStateException:应用程序的AndroidManifest.xml中的元数据标记的值不正确。预期为4030500,但发现为0。元素中必须具有以下声明

google-play-services_lib 清单:

<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
    package="com.google.android.gms"
    android:versionCode="4030530"
    android:versionName="4.0.30 (889083-30)" >

    <uses-sdk android:minSdkVersion="8"/>

</manifest>
public void loginGooglePlus() {
    aHelper.setup(this, GameHelper.CLIENT_APPSTATE | GameHelper.CLIENT_GAMES);
    mHelper = aHelper.getAppStateClient();
    //crash is here
    mHelper.connect();
}

完整的错误日志:

11-01 11:38:13.507: E/AndroidRuntime(31297): FATAL EXCEPTION: main
11-01 11:38:13.507: E/AndroidRuntime(31297): java.lang.RuntimeException: Unable to start activity ComponentInfo{com.company.application.android.aja/com.company.application.android.aja.BeetleBattleAndroidActivity}: java.lang.IllegalStateException: The meta-data tag in your app's AndroidManifest.xml does not have the right value.  Expected 4030500 but found 0.  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" />
11-01 11:38:13.507: E/AndroidRuntime(31297):    at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2077)
11-01 11:38:13.507: E/AndroidRuntime(31297):    at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2104)
11-01 11:38:13.507: E/AndroidRuntime(31297):    at android.app.ActivityThread.access$600(ActivityThread.java:134)
11-01 11:38:13.507: E/AndroidRuntime(31297):    at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1247)
11-01 11:38:13.507: E/AndroidRuntime(31297):    at android.os.Handler.dispatchMessage(Handler.java:99)
11-01 11:38:13.507: E/AndroidRuntime(31297):    at android.os.Looper.loop(Looper.java:154)
11-01 11:38:13.507: E/AndroidRuntime(31297):    at android.app.ActivityThread.main(ActivityThread.java:4624)
11-01 11:38:13.507: E/AndroidRuntime(31297):    at java.lang.reflect.Method.invokeNative(Native Method)
11-01 11:38:13.507: E/AndroidRuntime(31297):    at java.lang.reflect.Method.invoke(Method.java:511)
11-01 11:38:13.507: E/AndroidRuntime(31297):    at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:965)
11-01 11:38:13.507: E/AndroidRuntime(31297):    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:732)
11-01 11:38:13.507: E/AndroidRuntime(31297):    at dalvik.system.NativeStart.main(Native Method)
11-01 11:38:13.507: E/AndroidRuntime(31297): Caused by: java.lang.IllegalStateException: The meta-data tag in your app's AndroidManifest.xml does not have the right value.  Expected 4030500 but found 0.  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" />
11-01 11:38:13.507: E/AndroidRuntime(31297):    at com.google.android.gms.common.GooglePlayServicesUtil.n(Unknown Source)
11-01 11:38:13.507: E/AndroidRuntime(31297):    at com.google.android.gms.common.GooglePlayServicesUtil.isGooglePlayServicesAvailable(Unknown Source)
11-01 11:38:13.507: E/AndroidRuntime(31297):    at com.google.android.gms.internal.de.connect(Unknown Source)
11-01 11:38:13.507: E/AndroidRuntime(31297):    at com.google.android.gms.appstate.AppStateClient.connect(Unknown Source)
11-01 11:38:13.507: E/AndroidRuntime(31297):    at com.company.application.android.aja.BeetleBattleAndroidActivity.loginGooglePlus(BeetleBattleAndroidActivity.java:153)
11-01 11:38:13.507: E/AndroidRuntime(31297):    at com.company.application.android.aja.BeetleBattleAndroidActivity.onCreate(BeetleBattleAndroidActivity.java:143)
11-01 11:38:13.507: E/AndroidRuntime(31297):    at android.app.Activity.performCreate(Activity.java:4509)
11-01 11:38:13.507: E/AndroidRuntime(31297):    at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1050)
11-01 11:38:13.507: E/AndroidRuntime(31297):    at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2041)
11-01 11:38:13.507: E/AndroidRuntime(31297):    ... 11 more

问题答案:

你需要在清单中添加以下内容:

<application>
    <meta-data 
       android:name="com.google.android.gms.version" 
       android:value="@integer/google_play_services_version" />
    ...
</application>


 类似资料:
  • 伙计们,请帮帮我,我不能在Flitter中构建或升级任何东西,我会遇到很多类似失败的错误:构建失败,但有一个例外。 出了什么问题:任务'执行失败:app: check ReleaseAarMetadata'。 发生多个任务操作失败:执行com时发生故障。Android建筑格雷德尔。内部的任务。CheckAarMetadataWorkAction > 尝试:使用--stacktrace选项运行以获取

  • 问题内容: 从更新到后,我遇到以下错误 这是我用于Firestore的代码: 摇篮: 它工作正常,但是更新Firestore版本后却出现了此错误。在问这个问题之前,我尝试了stackoverflow / internet上所有可用的解决方案,但是没有任何运气。 问题答案: 从firebase支持答复中,如果将来有人遇到此问题,请尝试在解决方案中添加以下内容,以解决此问题:

  • 我想将我的所有软件包更新到最新版本: 谢谢!!

  • 我将android studio从3.3版本更新到3.4版本,在安装并执行出现了下一个错误: 在这个构建中使用了不推荐的Gradle特性,使其与Gradle6.0不兼容。 未能应用插件[id'com.android.application'] 最小支持的Gradle版本是5.1.1。当前版本为4.4.1。如果使用gradle包装器,请尝试将。gradle/daemon/4.4.1/gradle/w

  • 今天,我更新到bumblebee android版本,创建了一个新项目,并导入了一些库,包括dagger hilt。内置。gradle(模块)i插入: 而且是内置的。gradle(项目)我插入: 但android studio构建失败: 生成文件'H:\AndroidProject\WMTworkManagerToList\Build。格拉德尔线:7 插件[id:'dagger.hilt.andr

  • 所以在离开我的Android Studio项目一段时间后,我运行了所有的更新。