android apk 在上传到 Google Play 时没有对齐 [英] android apk not zip aligned when uploading to Google Play

查看:31
本文介绍了android apk 在上传到 Google Play 时没有对齐的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

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

when uploading my APK to Google Play I'm getting an error I've never encountered before. The window informs me that I'm uploading an APK that is not zip aligned. However when I've uploaded previous versions of the APK these errors never occurred.

我已经尝试通过终端手动 zip 对齐 APK,并在 build.gradle 文件中写入 zipAlignEnabled true 用于移动和穿戴.我将在下面发布完整的 gradle 文件

I've already tried manually zip aligning the APK manually through the terminal and writing zipAlignEnabled true in the build.gradle files for mobile and wear. I'll post the full gradle files below

另外我最近注意到当我点击生成签名的 apk 时,Android Studio 正在生成两个签名的 apk (一个名为 mobile-release.apk,一个名为wear-release.apk) 以前从未这样做过.这可能是一个原因吗?

Also I recently noticed that Android Studio is generating two signed apk's when I click generate signed apk (one named mobile-release.apk and one named wear-release.apk) It's never done this before. Could that be a reason why?

有什么帮助吗?

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 我从

I downloaded stable Android Studio 2.1 here: https://developer.android.com/studio/index.html Then in build.gradle I changed gradle plugin version from

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

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

重建、签名、上传 - 不再有 zipalign 错误.

Rebuild, sign, upload - no more zipalign errors.

更新:只需降级 Gradle 插件的版本即可.

UPDATE: Just downgrading the version of Gradle plugin should do the work.

这篇关于android apk 在上传到 Google Play 时没有对齐的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆