簡體   English   中英

上傳到Google Play時,android apk不對齊

[英]android apk not zip aligned when uploading to Google Play

將我的APK上傳到Google Play時,我收到的錯誤是我以前從未遇到過的。 窗口通知我我正在上傳一個非拉鏈對齊的APK。 但是,當我上傳以前版本的APK時,這些錯誤從未發生過。

我已經嘗試通過終端手動拉鏈對齊APK,並在build.gradle文件中編寫zipAlignEnabled true ,以便移動和佩戴。 我將在下面發布完整的gradle文件

另外我最近注意到,當我點擊生成簽名的apk (一個名為mobile-release.apk,一個名為wear-release.apk)時,Android Studio正在生成兩個已簽名的apk。之前從未這樣做過。 這可能是一個原因嗎?

有幫助嗎?

build.gradle(模塊:移動)

apply plugin: 'com.android.application'

android {
    compileSdkVersion 23
    buildToolsVersion "24-rc4"

defaultConfig {
    applicationId "com.vivekvinodh.example"
    minSdkVersion 21
    targetSdkVersion 23
    versionCode 11
    versionName "0.7"
    // Enabling multidex support.
    multiDexEnabled true
}
signingConfigs {
    release {
        storeFile file('***********')
        storePassword "************"
        keyAlias "******"
        keyPassword "************"
    }
}
buildTypes {
    release {
        minifyEnabled false
        proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        signingConfig signingConfigs.release
        zipAlignEnabled true
    }
}
}

dependencies {
     compile fileTree(include: ['*.jar'], dir: 'libs')
     wearApp project(':wear')
     compile 'com.android.support:appcompat-v7:23.4.0'
     compile 'com.google.android.gms:play-services:9.0.2'
     compile 'com.google.android.gms:play-services-ads:9.0.2'
     compile 'net.steamcrafted:materialiconlib:1.0.9''
     compile 'com.android.support:multidex:1.0.1'
     compile 'com.android.support:support-v4:23.4.0'
     ...
 }

build.gradle(模塊:穿)

apply plugin: 'com.android.application'


android {
    compileSdkVersion 23
    buildToolsVersion "24-rc4"

defaultConfig {
    applicationId "com.vivekvinodh.example"
    minSdkVersion 21
    targetSdkVersion 23
    versionCode 11
    versionName "0.7"
}
buildTypes {
    release {
        minifyEnabled false
        proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        zipAlignEnabled true
    }
}
}

dependencies {
    compile fileTree(dir: 'libs', include: ['*.jar'])
    compile 'com.google.android.support:wearable:1.4.0'
    compile 'com.google.android.gms:play-services-wearable:9.0.2'
    compile 'com.android.support:palette-v7:23.4.0'
    compile 'com.ustwo.android:clockwise-wearable:1.0.1'
    ...
}

這對我有所幫助:

我在這里下載了穩定的Android Studio 2.1: https//developer.android.com/studio/index.html然后在build.gradle中我更改了gradle插件版本

classpath 'com.android.tools.build:gradle:2.2.0-alpha3'

classpath 'com.android.tools.build:gradle:2.1.2'

重建,簽名,上傳 - 沒有更多的zipalign錯誤。

更新:只需降級Gradle插件版本即可完成工作。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM