上传到Google Play时,android apk不对齐

Viv*_*odh 7 android apk google-play android-studio zipalign

将我的APK上传到Google Play时,我收到的错误是我以前从未遇到过的.窗口通知我我正在上传一个非拉链对齐的APK.但是,当我上传以前版本的APK时,这些错误从未发生过.

我已经尝试通过终端手动拉链对齐APK并zipAlignEnabled truebuild.gradle文件中写入移动和佩戴.我将在下面发布完整的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'
     ...
 }
Run Code Online (Sandbox Code Playgroud)

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'
    ...
}
Run Code Online (Sandbox Code Playgroud)

aga*_*mov 12

这对我有所帮助:

我在这里下载了稳定的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插件版本即可完成工作.