【发布时间】:2016-10-13 12:25:38
【问题描述】:
在将我的 APK 上传到 Google Play 时,我遇到了以前从未遇到过的错误。该窗口通知我,我正在上传一个未与 zip 对齐的 APK。但是,当我上传以前版本的 APK 时,这些错误从未发生过。
我已经尝试通过终端手动压缩对齐 APK 并在 build.gradle 文件中写入 zipAlignEnabled true 以用于移动和穿戴。我将在下面发布完整的 gradle 文件
我最近还注意到,当我单击“生成签名的 apk”时,Android Studio 正在生成两个签名的 apk(一个名为 mobile-release.apk,一个名为 wear-release.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'
...
}
【问题讨论】:
-
在您的
build.gradle文件中minifyEnabled false将其更改为minifyEnabled true -
这也将帮助你[看到这个](stackoverflow.com/a/38055015/1978475)
标签: android android-studio google-play apk zipalign