Android 11应用程序崩溃,显示“应用程序的AndroidManifest.xml中的元数据标记的值不正确应该是12451000,但是找到了4323000”

如何解决Android 11应用程序崩溃,显示“应用程序的AndroidManifest.xml中的元数据标记的值不正确应该是12451000,但是找到了4323000”

我的应用程序在Android 11设备上开始崩溃,并显示以下错误消息“应用程序的AndroidManifest.xml中的元数据标记的值不正确。应为12451000,但找到的是4323000” 。我已经意识到了这些问题,并且已经在清单文件中定义了正确的值,如下所示:

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

如果我遵循google_play_services_version,我可以找到期望的值

<integer name="google_play_services_version">12451000</integer>

借助Firebase分析,我可以确认它仅在Android 11设备上发生。

impacted end user device

到目前为止,在各种SO帖子中,我尝试了以下操作:

1-将所有使用的播放服务和Firebase依赖项更新到最新的可用版本。

2-二手工具:在应用程序模块和磨损模块的元数据标签中,按以下步骤用构建清理过程替换:

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

3-检查所有已使用的第三部分库/ SDK清单文件中的@ integer / google_play_services_version,但所有文件都重定向到期望值,即12451000。

以下是build.gradle文件: A- build.gradle {:app}-

apply from: '../release-config.gradle'
apply plugin: 'com.android.application'
apply plugin: 'kotlin-android'
apply plugin: 'kotlin-android-extensions'
apply plugin: 'kotlin-kapt'
apply plugin: 'android-release-plugin'
apply plugin: 'testfairy'
apply from: '../sonar.gradle'
apply from: '../jacoco.gradle'
// Add the Firebase Crashlytics plugin.
apply plugin: 'com.google.firebase.crashlytics'

android.testOptions {
 unitTests.all {
    jacoco {
        includeNoLocationClasses = true
    }
}
unitTests.returnDefaultValues = true
}
tasks.sonarqube.dependsOn jacocoTestReport


android {
compileSdkVersion 30
buildToolsVersion '29.0.2'
ndkVersion "16.1.4479499"

kapt {
    javacOptions {
        option("-Adagger.gradle.incremental")
        option("-Adagger.formatGeneratedSource=disabled")
    }
}

dexOptions {
    javaMaxHeapSize "4g"
}

defaultConfig {
    applicationId "com.xx”
    minSdkVersion 23
    targetSdkVersion 30
    multiDexEnabled true
    testInstrumentationRunner 
    "androidx.test.runner.AndroidJUnitRunner"

    buildConfigField "String","SERVER_BASE",‘”————“’
    buildConfigField "String","LOCUSLABS_ACCOUNT_ID",‘”——“’
    buildConfigField "String","GCM_SENDER_ID",‘”———“’
    buildConfigField "String","GRAB_ID","GCT_CONVERSION_ID","GCT_LABEL","GCT_VALUE",‘”——“’
}

signingConfigs {

}

buildTypes {
    debug {
        versionNameSuffix "(Debuggable)"
        debuggable true
        zipAlignEnabled true
        minifyEnabled false
        proguardFiles getDefaultProguardFile('proguard-android.txt'),'proguard-rules.pro'
    }
    release {
        shrinkResources true
        signingConfig signingConfigs.release
        zipAlignEnabled true
        minifyEnabled true
        proguardFiles getDefaultProguardFile('proguard-android.txt'),'proguard-rules.pro'
        debuggable false
    }
}

flavorDimensions 'environment'

productFlavors {
    dev {
        applicationIdSuffix ".dev"
        buildConfigField "String",‘”——————‘

        def internalVersion = 
         releaseConfig.getAppVersion().internalVersion
        resValue "string","app_name","xx (Test) ${internalVersion}"
    }

    stage {
        applicationIdSuffix ".stage"
        buildConfigField "String",‘”—————“’—

        def internalVersion = 
        releaseConfig.getAppVersion().internalVersion
        resValue "string","xx (Stage) ${internalVersion}"
    }

    prod {
        buildConfigField "String",‘”———“’——
        buildConfigField "String",‘”———“’
        buildConfigField "String",‘”——“’
        buildConfigField "String",‘”———“’
    }
}

 packagingOptions {
    exclude 'META-INF/notice.txt'
    exclude 'META-INF/license.txt'
    exclude 'META-INF/ASL2.0'
    exclude 'META-INF/LICENSE'
    exclude 'META-INF/NOTICE'
    exclude 'META-INF/**rxjava.properties**'
}

lintOptions {
    abortOnError false
}

testfairyConfig {
    apiKey “———————“
}

testOptions {
    unitTests.returnDefaultValues = true
}

compileOptions {
    sourceCompatibility JavaVersion.VERSION_1_8
    targetCompatibility JavaVersion.VERSION_1_8
}

androidExtensions {
    experimental = true
}
}

def powermock_version = "2.0.2"
def daggerVersion = "2.16"
def leak_canary_version = "2.0-beta-1"

dependencies {
implementation fileTree(dir: 'libs',include: ['*.jar'])
implementation project(':common')
implementation('com.facebook.android:facebook-android-sdk:5.15.3') {
    exclude group: 'com.android.support'
}
implementation 'androidx.appcompat:appcompat:1.2.0'
implementation 'com.google.android.material:material:1.2.1'
implementation 'androidx.cardview:cardview:1.0.0'
implementation "androidx.constraintlayout:constraintlayout:2.0.2"
implementation "com.google.android.gms:play-services-base:17.4.0"
implementation "com.google.android.gms:play-services-location:17.1.0"
implementation "com.google.android.gms:play-services-maps:17.0.0"
implementation "com.google.android.gms:play-services-vision:20.1.2"
implementation "com.google.android.gms:play-services-wearable:17.0.0"
implementation 'androidx.core:core:1.3.2'
implementation 'com.romandanylyk:pageindicatorview:1.0.3'
implementation 'com.getbase:floatingactionbutton:1.10.1'
implementation 'com.wdullaer:materialdatetimepicker:4.2.3'

// need by grab sdk
implementation 'androidx.viewpager2:viewpager2:1.0.0'
implementation 'com.github.JakeWharton:ViewPagerIndicator:2.4.1'
implementation('com.squareup.retrofit2:retrofit:2.5.0') {
    // exclude Retrofit’s OkHttp peer-dependency module and define 
   your own module import
    exclude module: 'okhttp'
}
implementation 'com.squareup.retrofit2:adapter-rxjava2:2.3.0'
implementation 'com.squareup.okhttp3:okhttp:3.12.1'
implementation 'com.squareup.okhttp3:logging-interceptor:3.9.1'
implementation 'com.squareup.retrofit2:converter-gson:2.5.0'

implementation 'com.google.zxing:core:3.3.3'
implementation 'io.reactivex.rxjava2:rxjava:2.1.10'
implementation 'io.reactivex.rxjava2:rxandroid:2.0.2'
implementation 'com.airbnb.android:lottie:2.5.5'
implementation 'me.grantland:autofittextview:0.2.1'


implementation 'org.greenrobot:eventbus:3.1.1'
implementation 'com.github.bumptech.glide:glide:4.11.0'
kapt 'com.github.bumptech.glide:compiler:4.11.0'
implementation 'org.kamranzafar:jtar:2.2'
implementation 'org.tukaani:xz:1.5'
implementation 'io.reactivex:rxjava:1.3.0'
implementation 'io.reactivex:rxandroid:1.2.1'
implementation(name: 'locuslabs-android-sdk-2.3.10',ext: 'aar') {
    transitive = true
}
 implementation 'com.facebook.soloader:soloader:0.9.0'
implementation 'com.facebook.litho:litho-core:0.38.0'
implementation 'com.facebook.litho:litho-widget:0.38.0'
compileOnly 'com.facebook.litho:litho-annotations:0.38.0'
kapt 'com.facebook.litho:litho-processor:0.38.0'

// Firebase Dependencies
implementation "com.google.firebase:firebase-messaging:20.3.0"
// Add the Firebase Crashlytics SDK.
implementation 'com.google.firebase:firebase-crashlytics:17.2.2'
// Add the Firebase SDK for Google Analytics
implementation 'com.google.firebase:firebase-analytics:17.6.0'
implementation "com.google.firebase:firebase-core:17.5.1"

// Grab Dependencies
implementation(name: 'grab-framework-1.1.33',ext: 'aar')
implementation 'com.braintreepayments.api:braintree:2.16.0'
implementation 'com.android.volley:volley:1.1.1'
implementation 'androidx.recyclerview:recyclerview:1.1.0'
implementation 'com.google.code.gson:gson:2.8.5'
implementation 'com.amulyakhare:com.amulyakhare.textdrawable:1.0.1'
implementation 'de.hdodenhof:circleimageview:2.0.0'
implementation 'org.kamranzafar:jtar:2.2'
implementation group: 'com.googlecode.libphonenumber',name: 
'libphonenumber',version: '8.4.1'
implementation 'io.card:android-sdk:5.5.1'
api 'com.wunderlist:sliding-layer:1.2.5'

// Background Process
implementation 'com.evernote:android-job:1.4.2'

// Dagger
implementation "com.google.dagger:dagger-android:$daggerVersion"
implementation "com.google.dagger:dagger-android-support:$daggerVersion"
kapt "com.google.dagger:dagger-android-processor:$daggerVersion"
kapt "com.google.dagger:dagger-compiler:$daggerVersion"

// Paging
implementation 'androidx.paging:paging-runtime:2.1.2'

// Lifecycle
implementation "androidx.lifecycle:lifecycle-runtime:2.2.0"
implementation 'androidx.lifecycle:lifecycle-extensions:2.2.0'
kapt "androidx.lifecycle:lifecycle-compiler:2.2.0"

// Utils
implementation 'com.jakewharton.timber:timber:4.7.1'

//For updating styles attributes dynamically
implementation 'com.airbnb.android:paris:1.7.1'

// A memory leak detection library.
debugImplementation "com.squareup.leakcanary:leakcanary-android:${leak_canary_version}"
implementation "com.squareup.leakcanary:leakcanary-object-watcher-android:${leak_canary_version}"
implementation 'com.intuit.sdp:sdp-android:1.0.6'

wearApp project(':wearable')

//Test
testImplementation 'junit:junit:4.12'
testImplementation 'org.mockito:mockito-core:2.23.0'

testImplementation "org.powermock:powermock-module-junit4:${powermock_version}"
testImplementation "org.powermock:powermock-module-junit4-rule:${powermock_version}"
testImplementation "org.powermock:powermock-api-mockito2:${powermock_version}"
testImplementation "org.powermock:powermock-classloading-xstream:${powermock_version}"

androidTestImplementation('androidx.test.espresso:espresso-core:3.3.0') {
    exclude group: 'com.google.code.findbugs'
    exclude group: 'com.android.support',module: 'support-annotations'
}

androidTestImplementation('androidx.test:runner:1.3.0') {
    exclude group: 'com.android.support',module: 'support-annotations'
}
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
implementation ("com.github.tomeees:scrollpicker:1.7.4")

 }

 apply plugin: 'com.google.gms.google-services'

B-顶级build.gradle文件:

buildscript {
ext.kotlin_version = '1.3.72'

repositories {       
    maven { url 'https://plugins.gradle.org/m2/' }
    maven { url "http://www.bugsense.com/gradle/" }
    mavenLocal()
    jcenter()
    google()
    }

    dependencies {
    classpath 'com.android.tools.build:gradle:4.0.2'
    classpath 'com.dminc.gradle:android-release-plugin:1.1.0.6'
    classpath 'com.testfairy.plugins.gradle:testfairy:2.0'
    classpath 'org.sonarsource.scanner.gradle:sonarqube-gradle-plugin:2.6.2'
    classpath 'com.google.gms:google-services:4.3.4'
    classpath 'com.google.firebase:firebase-crashlytics-gradle:2.3.0'
    classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
    }

    }

     allprojects {
     repositories {
     flatDir { dirs 'libs' }
     mavenLocal()
     mavenCentral()
     google()
     }
     }

我正在从“启动画面” {luncher activity}检查Play服务的可用性。我什至尝试通过应用try-catch来捕获引发的异常并能够成功捕获它,但是应用仍然崩溃:

我正在从“启动画面” {luncher activity}检查Play服务的可用性。我什至尝试通过应用try catch并能够成功捕获它来捕获抛出的异常,但是应用仍然崩溃:

    public static int checkPlayServices(Context activity) {
     int retValue;

    try {
        int resultCode = GoogleApiAvailability.getInstance().isGooglePlayServicesAvailable(activity);
        Timber.tag(TAG).d(  "This device is supported with api version%s",GoogleApiAvailability.getInstance().getClientVersion(activity));

        if (resultCode != ConnectionResult.SUCCESS) {
            if (GoogleApiAvailability.getInstance().isUserResolvableError(resultCode)) {
                retValue = PLAY_STORE_RESOLVABLE_ERROR;
                Timber.tag(TAG).d( "This device is supported but can be resolved.");
            } else {
                Timber.tag(TAG).d(  "This device is not supported and cannot be resolved.");
                retValue = PLAY_STORE_UN_SUPPORT;
            }
        } else {
            retValue = PLAY_STORE_AVAILABLE;
        }
    } catch (java.lang.IllegalStateException e) {
        Timber.tag(TAG).d( "This device Throws Illegal state Exception. Probably caused by google_play_services_version");
        Timber.tag(TAG).e( e.getMessage());
        retValue = PLAY_STORE_VERSION_ERROR;
    } catch (java.lang.Exception e) {
        Timber.tag(TAG).d(  "This device Throws Exception. Exact Reason is unknown");
        Timber.tag(TAG).e(  e.getMessage());
        retValue = PLAY_STORE_ERROR;
    }
    return retValue;
}

我能够捕获但应用程序仍然崩溃,这使我想到另一个想法,可能是其他SDK依赖项引发了此异常。我检查了所有第三个SDK的内容,发现另外两个SDK的{Facebook和Braintree付款也在检查Google Play服务}。

_我已经删除了两个SDK,但仍然崩溃。

注意:此崩溃仅在所有构建版本的Android 11设备/模拟器上发生。

现在我别无选择。任何线索都将非常有帮助。

谢谢。

解决方法

问题已解决。

只需更改meta标签的顺序即可。版本标记应始终放在第一位。

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

        <meta-data
            android:name="com.google.android.maps.v2.API_KEY"
            android:value="@string/google_api_key"
            tools:replace="android:value" />
,

如果您具有元标记,那么大多数情况下,答案就在于具有兼容的库版本和不建议使用的方法的更新的组合。

您在build.gradle中提到了以下内容:

实现('com.facebook.android:facebook-android-sdk:5.15.3')

我在使用上述Facebook SDK版本的 Android 11 上熟悉的一个可能原因是使用了不赞成使用的方法 activateApp 导致了上述问题。

将方法 AppEventsLogger.activateApp(this); 更新为:

 WARNING: Bad request to Splash: {'error': 400,'type': 'ScriptError','description': 'Error happened while executing Lua script','info': {'source': '[string "..."]','line_number': 9,'error': "'for' limit must be a number",'type': 'LUA_ERROR','message WARNING: Bad request to Splash: {'error': 400,'message': 'Lua error: [string "..."]:9: \'for\' limit must be a number'}}

让我们知道它是否对您有用。

,

是的! 我找到了解决方案。 问题出在图书馆:

implementation "com.google.firebase:firebase-core:17.5.1"

只需替换为

implementation 'com.google.firebase:firebase-core:16.0.3'

上面的库加载了“地下室库”,最后我们有了两个“地下室”库。 第一个由“播放服务”库加载,第二个由“ firebase-core”加载

有关更多点击,请点击以下网址: The library com.google.android.gms:play-services-basement is being requested by various other libraries at [[15.0.1,15.0.1]],but resolves to 11.8.0

还有这个

https://github.com/evollu/react-native-fcm/issues/1026

如果此答案对您没有帮助,请阅读有关'com.google.firebase:firebase-core:16.0.3'内的gradle和force库的信息 如下所示:

implementation ("com.google.firebase:firebase-core:16.0.3") {
        force = true
    }

注意: 不建议使用“强制”方法,必须使用新功能

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。

相关推荐


使用本地python环境可以成功执行 import pandas as pd import matplotlib.pyplot as plt # 设置字体 plt.rcParams[&#39;font.sans-serif&#39;] = [&#39;SimHei&#39;] # 能正确显示负号 p
错误1:Request method ‘DELETE‘ not supported 错误还原:controller层有一个接口,访问该接口时报错:Request method ‘DELETE‘ not supported 错误原因:没有接收到前端传入的参数,修改为如下 参考 错误2:cannot r
错误1:启动docker镜像时报错:Error response from daemon: driver failed programming external connectivity on endpoint quirky_allen 解决方法:重启docker -&gt; systemctl r
错误1:private field ‘xxx‘ is never assigned 按Altʾnter快捷键,选择第2项 参考:https://blog.csdn.net/shi_hong_fei_hei/article/details/88814070 错误2:启动时报错,不能找到主启动类 #
报错如下,通过源不能下载,最后警告pip需升级版本 Requirement already satisfied: pip in c:\users\ychen\appdata\local\programs\python\python310\lib\site-packages (22.0.4) Coll
错误1:maven打包报错 错误还原:使用maven打包项目时报错如下 [ERROR] Failed to execute goal org.apache.maven.plugins:maven-resources-plugin:3.2.0:resources (default-resources)
错误1:服务调用时报错 服务消费者模块assess通过openFeign调用服务提供者模块hires 如下为服务提供者模块hires的控制层接口 @RestController @RequestMapping(&quot;/hires&quot;) public class FeignControl
错误1:运行项目后报如下错误 解决方案 报错2:Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:3.8.1:compile (default-compile) on project sb 解决方案:在pom.
参考 错误原因 过滤器或拦截器在生效时,redisTemplate还没有注入 解决方案:在注入容器时就生效 @Component //项目运行时就注入Spring容器 public class RedisBean { @Resource private RedisTemplate&lt;String
使用vite构建项目报错 C:\Users\ychen\work&gt;npm init @vitejs/app @vitejs/create-app is deprecated, use npm init vite instead C:\Users\ychen\AppData\Local\npm-
参考1 参考2 解决方案 # 点击安装源 协议选择 http:// 路径填写 mirrors.aliyun.com/centos/8.3.2011/BaseOS/x86_64/os URL类型 软件库URL 其他路径 # 版本 7 mirrors.aliyun.com/centos/7/os/x86
报错1 [root@slave1 data_mocker]# kafka-console-consumer.sh --bootstrap-server slave1:9092 --topic topic_db [2023-12-19 18:31:12,770] WARN [Consumer clie
错误1 # 重写数据 hive (edu)&gt; insert overwrite table dwd_trade_cart_add_inc &gt; select data.id, &gt; data.user_id, &gt; data.course_id, &gt; date_format(
错误1 hive (edu)&gt; insert into huanhuan values(1,&#39;haoge&#39;); Query ID = root_20240110071417_fe1517ad-3607-41f4-bdcf-d00b98ac443e Total jobs = 1
报错1:执行到如下就不执行了,没有显示Successfully registered new MBean. [root@slave1 bin]# /usr/local/software/flume-1.9.0/bin/flume-ng agent -n a1 -c /usr/local/softwa
虚拟及没有启动任何服务器查看jps会显示jps,如果没有显示任何东西 [root@slave2 ~]# jps 9647 Jps 解决方案 # 进入/tmp查看 [root@slave1 dfs]# cd /tmp [root@slave1 tmp]# ll 总用量 48 drwxr-xr-x. 2
报错1 hive&gt; show databases; OK Failed with exception java.io.IOException:java.lang.RuntimeException: Error in configuring object Time taken: 0.474 se
报错1 [root@localhost ~]# vim -bash: vim: 未找到命令 安装vim yum -y install vim* # 查看是否安装成功 [root@hadoop01 hadoop]# rpm -qa |grep vim vim-X11-7.4.629-8.el7_9.x
修改hadoop配置 vi /usr/local/software/hadoop-2.9.2/etc/hadoop/yarn-site.xml # 添加如下 &lt;configuration&gt; &lt;property&gt; &lt;name&gt;yarn.nodemanager.res