You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

Android 14应用兼容性警告解决与调试方法咨询

解决Android 14安装兼容性警告问题

我的应用首次安装在Android 14设备上时,会弹出以下警告:

This app isn't compatible with the latest version of Android.
check for an update or contact the app's developer.

我已升级应用依赖库并检查AndroidManifest.xml是否存在Android 14冲突,现咨询如何解决该警告及调试排查问题的方法,以下是我的build.gradle文件:

apply plugin: 'com.android.application'

//repositories {
//    mavenCentral()
//    google()
//    maven {
//        url "https://linphone.org/maven_repository"
//    }
//}

configurations {
    compile.exclude module: 'support-v4'
}

configurations.all {
//    exclude group: 'com.google.firebase', module: 'firebase-core'
    exclude group: 'androidx.recyclerview', module: 'recyclerview'
}

dependencies {
    implementation 'androidx.core:core:1.10.1'
    implementation 'androidx.palette:palette:1.0.0'
    implementation 'androidx.exifinterface:exifinterface:1.3.7'
    implementation 'androidx.dynamicanimation:dynamicanimation:1.0.0'
    implementation 'androidx.multidex:multidex:2.0.1'
    implementation "androidx.sharetarget:sharetarget:1.2.0"
    implementation 'androidx.interpolator:interpolator:1.0.0'

    compileOnly 'org.checkerframework:checker-qual:3.12.0'
    compileOnly 'org.checkerframework:checker-compat-qual:2.5.0'
//    implementation 'com.google.firebase:firebase-messaging:22.0.0'
//    implementation 'com.google.firebase:firebase-config:21.0.1'
//    implementation 'com.google.firebase:firebase-datatransport:18.0.1'
//    implementation 'com.google.firebase:firebase-appindexing:20.0.0'
//    implementation 'com.google.android.gms:play-services-maps:17.0.1'
//    implementation 'com.google.android.gms:play-services-auth:19.2.0'
    implementation 'com.google.android.gms:play-services-vision:20.1.3'
//    implementation 'com.google.android.gms:play-services-wearable:17.1.0'
//    implementation 'com.google.android.gms:play-services-wallet:18.1.3'
    implementation 'com.googlecode.mp4parser:isoparser:1.0.6'
    implementation 'com.stripe:stripe-android:2.0.2'
    implementation 'com.google.code.gson:gson:2.10'
    implementation 'com.fasterxml.jackson.core:jackson-core:2.12.1'
    implementation 'com.fasterxml.jackson.core:jackson-annotations:2.12.1'
    implementation 'com.fasterxml.jackson.core:jackson-databind:2.12.1'
    implementation 'com.squareup.okhttp3:okhttp:3.12.10'
    implementation files('libs/libgsaverification-client.aar')

    coreLibraryDesugaring 'com.android.tools:desugar_jdk_libs:2.0.4'

    //Play Services
//    implementation 'com.google.android.gms:play-services-gcm:16.1.0'
    implementation 'com.google.android.gms:play-services-location:21.0.1'

    implementation project(':liveVideoBroadcasterSDK')
    implementation "ch.acra:acra-http:5.2.1"
    implementation "ch.acra:acra-dialog:5.2.1"

    implementation 'androidx.fragment:fragment:1.5.3'
    implementation 'androidx.annotation:annotation:1.7.1'

//    implementation project(':datepicker')
    implementation 'org.linphone.minimal:linphone-sdk-android:5.2.112'
    implementation 'androidx.media:media:1.2.0'

    implementation 'net.butterflytv.utils:rtmp-client:3.1.0'
    implementation(platform("org.jetbrains.kotlin:kotlin-bom:1.8.0"))
    implementation project(':xxxxx')

}

android {
//    compileSdkVersion 31
//    buildToolsVersion '31.0.0'
    ndkVersion "21.4.7075529"
    compileSdk 34

    defaultConfig.applicationId = "xxx.xxxxx.xxxxxx"
    namespace = "xxx.xxxxx.xxxxxx"

    sourceSets.main.jniLibs.srcDirs = ['./jni/']

    externalNativeBuild {
        cmake {
            path 'jni/CMakeLists.txt'
        }
    }

    lintOptions {
        disable 'MissingTranslation'
        disable 'ExtraTranslation'
        disable 'BlockedPrivateApi'
    }

//    dexOptions {
//        jumboMode = true
//    }

    compileOptions {
        sourceCompatibility JavaVersion.VERSION_1_8
        targetCompatibility JavaVersion.VERSION_1_8

        coreLibraryDesugaringEnabled true
    }

    signingConfigs {
        debug {
            storeFile file("config/release.keystore")
            storePassword RELEASE_STORE_PASSWORD
            keyAlias RELEASE_KEY_ALIAS
            keyPassword RELEASE_KEY_PASSWORD
        }

        release {
            storeFile file("config/release.keystore")
            storePassword RELEASE_STORE_PASSWORD
            keyAlias RELEASE_KEY_ALIAS
            keyPassword RELEASE_KEY_PASSWORD
        }
    }

    buildTypes {
        debug {
            debuggable true
            jniDebuggable true
            signingConfig signingConfigs.debug
            applicationIdSuffix ""
            minifyEnabled false
            shrinkResources false
            multiDexEnabled true
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
            ndk.debugSymbolLevel = 'FULL'
        }

//        gozaresh {
//            debuggable true
//            jniDebuggable true
//            signingConfig signingConfigs.debug
//            applicationIdSuffix ".beta"
//            minifyEnabled false
//            shrinkResources false
//            multiDexEnabled true
//            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
//            ndk.debugSymbolLevel = 'FULL'
//        }

        /*debugAsan {
            debuggable true
            jniDebuggable true
            signingConfig signingConfigs.debug
            applicationIdSuffix ".beta"
            minifyEnabled true
            multiDexEnabled true
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'

            packagingOptions {
                doNotStrip "**.so"
            }

            sourceSets {
                main {
                    jniLibs {
                        srcDir {
                            'jniLibs'
                        }
                    }
                    resources {
                        srcDir {
                            'jniRes'
                        }
                    }
                }
            }
        }*/

//        HA {
//            debuggable false
//            jniDebuggable false
//            signingConfig signingConfigs.debug
//            applicationIdSuffix ".beta"
//            minifyEnabled true
//            multiDexEnabled true
//            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
//            ndk.debugSymbolLevel = 'FULL'
//        }

//        standalone {
//            debuggable false
//            jniDebuggable false
//            signingConfig signingConfigs.release
//            applicationIdSuffix ".web"
//            minifyEnabled true
//            multiDexEnabled true
//            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
//            ndk.debugSymbolLevel = 'FULL'
//        }

        release {
            debuggable false
            jniDebuggable false
            signingConfig signingConfigs.release
            minifyEnabled true
            shrinkResources false
            multiDexEnabled true
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
            ndk.debugSymbolLevel = 'FULL'
        }
    }

    sourceSets.debug {
        manifest.srcFile 'config/debug/AndroidManifest.xml'
    }

    /*sourceSets.debugAsan {
        manifest.srcFile 'config/debug/AndroidManifest.xml'
    }*/

//    sourceSets.HA {
//        manifest.srcFile 'config/debug/AndroidManifest.xml'
//    }

//    sourceSets.standalone {
//        manifest.srcFile 'config/release/AndroidManifest.xml'
//    }

    sourceSets.release {
        manifest.srcFile 'config/release/AndroidManifest.xml'
    }
//    sourceSets.gozaresh {
//        manifest.srcFile 'config/debug/AndroidManifest.xml'
//    }

    flavorDimensions "minApi"

    productFlavors {
        armv7 {
            ndk {
                abiFilters "armeabi-v7a"
            }
            ext {
                abiVersionCode = 1
            }
        }
//        x86 {
//            ndk {
//                abiFilters "x86"
//            }
//            ext {
//                abiVersionCode = 2
            }
//        }
//        armv7_SDK23 {
//            ndk {
//                abiFilters "armeabi-v7a"
//            }
//            sourceSets.debug {
//                manifest.srcFile 'config/debug/AndroidManifest_SDK23.xml'
//            }
//            sourceSets.release {
//                manifest.srcFile 'config/release/AndroidManifest_SDK23.xml'
//            }
//            minSdkVersion 23
//            ext {
//                abiVersionCode = 3
//            }
//        }
//        x86_SDK23 {
//            ndk {
//                abiFilters "x86"
//            }
//            sourceSets.debug {
//                manifest.srcFile 'config/debug/AndroidManifest_SDK23.xml'
//            }
//            sourceSets.release {
//                manifest.srcFile 'config/release/AndroidManifest_SDK23.xml'
//            }
//            minSdkVersion 23
//            ext {
//                abiVersionCode = 4
//            }
//        }
//        arm64 {
//            ndk {
//                abiFilters "arm64-v8a"
//            }
//            ext {
//                abiVersionCode = 5
//            }
//        }
//        x64 {
//            ndk {
//                abiFilters "x86_64"
//            }
//            ext {
//                abiVersionCode = 6
//            }
//        }
//        arm64_SDK23 {
//            ndk {
//                abiFilters "arm64-v8a"
//            }
//            sourceSets.debug {
//                manifest.srcFile 'config/debug/AndroidManifest_SDK23.xml'
//            }
//            sourceSets.release {
//                manifest.srcFile 'config/release/AndroidManifest_SDK23.xml'
//            }
//            minSdkVersion 23
//            ext {
//                abiVersionCode = 7
//            }
//        }
//        x64_SDK23 {
//            ndk {
//                abiFilters "x86_64"
//            }
//            sourceSets.debug {
//                manifest.srcFile 'config/debug/AndroidManifest_SDK23.xml'
//            }
//            sourceSets.release {
//                manifest.srcFile 'config/release/AndroidManifest_SDK23.xml'
//            }
//            minSdkVersion 23
//            ext {
//                abiVersionCode = 8
//            }
//        }
        afat {
            ndk {
                abiFilters "armeabi-v7a"/*, "arm64-v8a", "x86", "x86_64"*/
            }
            sourceSets.debug {
                manifest.srcFile 'config/debug/AndroidManifest_SDK23.xml'
            }
            sourceSets.release {
                manifest.srcFile 'config/release/AndroidManifest_SDK23.xml'
            }
//            sourceSets.standalone {
//                manifest.srcFile 'config/release/AndroidManifest_standalone.xml'
//            }
            ext {
                abiVersionCode = 9
            }
        }
    }

    defaultConfig.versionCode = 2460

    applicationVariants.all { variant ->
        variant.outputs.all { output ->
            outputFileName = outputFileName = "xxxx-7.0.0(" + defaultConfig.versionCode + ").apk"
            output.versionCodeOverride = defaultConfig.versionCode * 10 + variant.productFlavors.get(0).abiVersionCode
        }
    }

    variantFilter { variant ->
        def names = variant.flavors*.name
        if (variant.buildType.name != "release" && !names.contains("afat")) {
            setIgnore(true)
        }
    }

    defaultConfig {
        minSdkVersion 21
        targetSdkVersion 34
        versionName "34.2.0"

        vectorDrawables.generatedDensities = ['mdpi', 'hdpi', 'xhdpi', 'xxhdpi']

        externalNativeBuild {
            cmake {
                version '3.10.2'
                arguments '-DANDROID_STL=c++_static', '-DANDROID_PLATFORM=android-16'/*, "-j=16"*/ //todo enable parallel threads for the cross-compilation process
            }
        }
    }
}

一、解决与排查方向

  • ABI架构适配:当前afat flavor仅支持armeabi-v7a,而多数Android 14设备是arm64-v8a架构,虽然向下兼容,但部分设备的兼容性检测会触发警告。建议添加arm64-v8a支持:
    afat {
        ndk {
            abiFilters "armeabi-v7a", "arm64-v8a"
        }
        // 其余配置保持不变
    }
    
  • 升级NDK与CMake版本:当前NDK 21.4和CMake 3.10.2版本过旧,对Android 14的适配支持不足。建议将NDK升级到25.x+(如25.2.9519653),CMake升级到3.22.1+,同时修改externalNativeBuild配置:
    externalNativeBuild {
        cmake {
            version '3.22.1'
            arguments '-DANDROID_STL=c++_static', '-DANDROID_PLATFORM=android-21' // 与minSdkVersion保持一致
        }
    }
    
  • 检查第三方依赖兼容性:
    • com.stripe:stripe-android:2.0.2版本过旧,需升级到适配Android 14的最新稳定版;
    • 确认net.butterflytv.utils:rtmp-client:3.1.0是否支持Android 14的API与权限要求;
    • 本地aar包libgsaverification-client.aar需验证是否适配Android 14。
  • Manifest文件二次校验:
    • 确认所有flavor的Manifest中targetSdkVersion统一为34;
    • 检查是否使用了Android 14中被禁用的废弃API;
    • 确认Android 14新增权限(如POST_NOTIFICATIONS)的声明是否合规。

二、调试排查方法

  • APK Analyzer分析:用Android Studio的APK Analyzer查看合并后的AndroidManifest.xml,确认targetSdkVersion、权限、组件配置是否正确;同时检查lib目录下的so文件架构是否完整。
  • 运行兼容性测试:在Android Studio中使用App Compatibility Test Suite针对Android 14设备运行测试,获取具体的兼容性冲突报告。
  • 日志定位原因:安装应用时通过adb logcat过滤PackageManager日志,查找具体的兼容性拒绝信息:
    adb logcat | grep -i "PackageManager" | grep -i "compatible"
    
  • 多架构设备测试:在arm64-v8a架构的Android 14设备上测试安装,对比armeabi-v7a设备的差异,确认是否由ABI适配问题导致警告。

内容的提问来源于stack exchange,提问作者Mahdi Iranmanesh

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.07.02 01:09:53