由于要在Play商店上发布的APK大小,我正在构建基于ABI的发布APK。

因此,我开始为 ABI = armeabi-v7a 构建APK,然后构建 ABI = x86和ABI = areambi

所以我的摇篮看起来像这样

应用程式gradle

android {
    compileSdkVersion 26
    buildToolsVersion "26.0.1"
    defaultConfig {
        applicationId "com.package"
        minSdkVersion 18
        targetSdkVersion 26
        versionCode 1
        versionName "1.0"
        multiDexEnabled true
        ndk {
            abiFilters "armeabi-v7a"
        }
    }
    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
    }
    externalNativeBuild {
        ndkBuild {
            path 'src/main/jni/Android.mk'
        }
    }
    splits {
        // Configures multiple APKs based on ABI.
        abi {
            // Enables building multiple APKs per ABI.
            enable true
            // By default all ABIs are included, so use reset() and include to specify that we only
            // want APKs for x86, armeabi-v7a, and mips.

            // Resets the list of ABIs that Gradle should create APKs for to none.
            reset()

            // Specifies a list of ABIs that Gradle should create APKs for.
            include "armeabi-v7a"

            // Specifies that we do not want to also generate a universal APK that includes all ABIs.
            universalApk false
        }
    }
}

android - 根据 native ABI生成多个Apk-LMLPHP

所以我的问题
  • 我需要为每个ABI的versionCode 1进行更改,因此应该使用哪个ABI的版本代码。
  • 最佳答案

    productFlavors{
    
        arm{
            ndk{
                abiFilters "arm64-v8a" , "armeabi"  , "armeabi-v7a"
            }
        }
        x86{
            ndk{
                abiFilters "x86" , "x86_64"
            }
        }
    }
    

    关于android - 根据 native ABI生成多个Apk,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/47302063/

    10-13 02:04