【问题标题】:Fully shadow apk issue on newly released app新发布的应用程序上的完全影子 apk 问题
【发布时间】:2018-07-08 09:02:36
【问题描述】:

我在将多个拆分 abi 上传到 google play 时遇到问题,我已经尝试了以前问题的解决方案,但它们对我几乎没有好处。

下面是我的 build.gradle 配置:

apply plugin: 'com.android.application'

android {
//    compileSdkVersion 24
//    buildToolsVersion '24.0.3'
    signingConfigs {
        config {
            keyAlias 'unikey'
            keyPassword '*****'
            storeFile file('E:/Projects/CompanyDroid/AppSigner/mykey.jks')
            storePassword '*****'
        }
    }
    compileSdkVersion 27
    //buildToolsVersion '23.0.1'
    defaultConfig {
        applicationId "com.aethtech.myapp"
        minSdkVersion 15
        targetSdkVersion 27
        versionCode 3
        versionName "1.0"
        testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
        signingConfig signingConfigs.config
    }
    splits {
        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.

            reset()
            include 'x86', 'x86_64', 'armeabi-v7a', 'arm64-v8a'

            // Specifies that we do not want to also generate a universal APK that includes all ABIs.
            universalApk true
        }
    }
    project.ext.versionCodes = ['armeabi': 1, 'armeabi-v7a': 2, 'arm64-v8a': 3, 'mips': 5, 'mips64': 6, 'x86': 8, 'x86_64': 9]

    android.applicationVariants.all { variant ->
        variant.outputs.each { output ->
            output.versionCodeOverride =
                    project.ext.versionCodes.get(output.getFilter(
                            com.android.build.OutputFile.ABI), 0) * 10000000 + android.defaultConfig.versionCode
        }
    }
    buildTypes {
        release {
            debuggable false
            jniDebuggable false
            renderscriptDebuggable false
            zipAlignEnabled true
            minifyEnabled true
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
            signingConfig signingConfigs.config
            versionNameSuffix '1.0'
        }
    }
    productFlavors {
    }
}

dependencies {
    compile fileTree(include: ['*.jar'], dir: 'libs')
    androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', {
        exclude group: 'com.android.support', module: 'support-annotations'
    })
    compile 'com.android.support:appcompat-v7:23.4.0'
    compile 'com.android.support:design:23.4.0'
    compile 'com.android.support:support-v4:23.4.0'
    compile 'com.github.paolorotolo:appintro:4.1.0'
    compile 'com.android.support.test.espresso:espresso-core:2.2.2'
    compile 'com.google.android.gms:play-services-ads:+'
    testCompile 'junit:junit:4.12'
}

google play store 中的错误如下:

另一个:

版本代码或 abi 拆分是否有问题,我是 android studio 的新手,所以我无法找到任何线索说明为什么会发生这种情况。

【问题讨论】:

    标签: android google-play apk abi


    【解决方案1】:

    将您的 targetSdkVersion 更改为 26 ,最新的 targetSdkVersion26 并且您的 targetSdkVersion27 高于最新的。

    参考:https://developer.android.com/about/versions/oreo/android-8.0-migration.html

    请记住,每次在 Play 商店上载发布 apk 时,总是将 versionCode 提高到高于以前的版本。

    android {
    compileSdkVersion 26
    buildToolsVersion "26.0.2"
    defaultConfig {
         applicationId "com.aethtech.myapp"
        minSdkVersion 15
        targetSdkVersion 26
        versionCode 3
        versionName "1.0"
        testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
    }
    

    或检查这个, 您在 Play 商店中使用多个 apk 吗?或者即使您使用一个 apk 但使用 splits gradle 功能,这也被认为是 Play 商店的“多个” apk。我认为可以使用类似于此处描述的版本代码方案来避免该错误。https://developer.android.com/google/play/publishing/multiple-apks.html#VersionCodes

    【讨论】:

    • 在尝试查看时仍然存在相同的问题,是否进行了更改但没有解决方案:(
    • 在您的 android studio 上创建新项目并将 gradle 与该应用程序 gradle 进行比较。
    • 好的,我也尝试生成通用 apk,但它也生成与我的其他 abis 相同大小 3.75 mb 相同的大小,这不应该发生,因为通用 abi 包含好吗?
    • 必须签出该网址?我评论了
    【解决方案2】:

    你的 gradle 文件说:

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

    但它有

    universalApk true
    

    是否有可能您正在上传一个通用 APK,而这个通用 APK 会影响您的所有其他 APK?

    另外,从您的 gradle 文件中,我希望看到上传 4 个 APK(每个本地 ABI 一个),但您正在上传 2 个。这看起来也有问题。

    【讨论】:

    • 不,我没有上传通用 apk,我确实只是为了测试目的才这样做
    • 起初我尝试上传所有 4 个,但是当我遇到这个问题时,我从 Play 商店中删除了草稿,并尝试上传并一一查看以查看每个 apk 是否出现问题并且它就在那里
    • 您的应用中真的有任何原生代码吗?如果您不这样做,APK 将或多或少相同并相互影响
    • 感谢@nick Fortescue,这正是我的应用程序的问题,来自 xamarin 背景我没有注意到只有具有本机库的应用程序有差异。架构要求
    【解决方案3】:

    您需要以这种格式放置 Gradle。 (具体ABI 版本 代码顺序

    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 and x86_64.
                // 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 "x86", "x86_64", "armeabi", "arm64-v8a", "armeabi-v7a", "mips"
    
                // Specifies that we do not want to also generate a universal APK that includes all ABIs.
                universalApk true
            }
        }
    ext.abiCodes = ['x86': 3, 'x86_64': 4, 'armeabi-v7a': 5, 'arm64-v8a': 6, armeabi: 1, mips: 2]
    

    【讨论】:

    • 他没有这样做吗?
    • 不,他没有。我有同样的问题,然后我应用了上面的代码。
    • 哦,我明白了,你介意看看我昨天问的一个问题吗? stackoverflow.com/questions/52253127/…
    猜你喜欢
    • 2018-05-20
    • 1970-01-01
    • 1970-01-01
    • 2023-04-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2017-07-13
    • 1970-01-01
    相关资源
    最近更新 更多