上传到Google Play时,android apk不对齐 [英] android apk not zip aligned when uploading to Google Play
问题描述
将我的APK上传到Google Play时遇到了以前从未遇到的错误。该窗口告诉我,我正在上传未对齐的APK。但是,当我上传了以前版本的APK时,这些错误从未发生过。
我已经尝试通过终端手动对齐APK,并在<$ zipAlignEnabled true
c $ c> build.gradle 移动和磨损文件。我将在下面发布完整的gradle文件
另外我最近注意到,当我点击生成已签名的apk (一个名为mobile- release.apk和一个名为wear-release.apk)它从来没有这样做过。这可能是为什么?
任何帮助? build.gradle(Module:mobile)
apply plugin:'com.android.application'
android {
compileSdkVersion 23
buildToolsVersion24-rc4
defaultConfig {
applicationIdcom.vivekvinodh.example
minSdkVersion 21
targetSdkVersion 23
versionCode 11
versionName0.7
//启用multidex支持。
multiDexEnabled true
}
signingConfigs {
release {
storeFile file('***********')
storePassword ************
keyAlias******
keyPassword************
}
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'),'proguard-rules.pro'
signedConfig signingConfigs.release
zipAlignEnabled true
$ dependencies {
compile fileTree(include:['* .jar' ],dir:'libs')
wearApp项目(':wear')
编译'com.android.support:appcompat-v7:23.4.0'
编译'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''
编译'com.android.support:multidex:1.0.1'
compile'com.android.support:support-v4:23.4.0'
...
}
build.gradle(模块:穿着)
apply插件:'com.android.application'
android {
compileSdkVersion 23
buildToolsVersion24-rc4
defaultConfig {
applicationIdcom.vivekvinodh.example
minSdkVersion 21
targetSdkVersion 23
versionCode 11
versionName0.7
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'),'proguard-rules.pro'
zipAlignEnabled true
}
}
}
依赖关系{
编译fileTree(dir:'libs',include:['* .jar'])
编译'com.google.android.support :wearable:1.4.0'
compile'com.google.android.gms:play-services-wearable:9.0.2'
compile'com.and roid.support:palette-v7:23.4.0'
compile'com.ustwo.android:clockwise-wearable:1.0.1'
...
}
code>
这是对我的帮助:
我在这里下载了稳定的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插件的版本即可完成工作。
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.
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
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?
Any help?
build.gradle (Module: mobile)
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 (Module: wear)
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'
...
}
This is what helped me:
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'
to
classpath 'com.android.tools.build:gradle:2.1.2'
Rebuild, sign, upload - no more zipalign errors.
UPDATE: Just downgrading the version of Gradle plugin should do the work.
这篇关于上传到Google Play时,android apk不对齐的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!