2016-06-13 54 views
7

將APK上傳到Google Play時遇到了我以前從未遇到的錯誤。該窗口告訴我,我正在上傳未對齊的APK。但是,當我上傳了以前版本的APK時,這些錯誤從未發生過。android APK上傳到Google Play時不對齊

我已經嘗試過通過終端手動對齊APK,並且在build.gradle文件中爲zipAlignEnabled true對齊移動和磨損。我會後下面

全gradle這個文件還我最近發現,Android的工作室生成兩個簽署apk的,當我點擊生成APK簽署(一個名爲移動release.apk和一個名爲磨損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' 
    ... 
} 
+0

在您的'build.gradle'文件中'minifyEnabled false'將其更改爲'minifyEnabled true' – Shashanth

+0

這也可以幫助您[見此](http://stackoverflow.com/a/38055015/1978475) – Vrajesh

回答

12

這是幫助我:

我下載穩定的Android Studio 2.1在這裏:​​3210 然後,在我的build.gradle的gradle改變插件版本從

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

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

重建,標誌,上傳 - 沒有更多的zipalign錯誤。

更新: 只是降級Gradle插件的版本應該做的工作。

+0

這工作!謝謝 –

+0

終於解決了,謝謝! – Michal

+1

更多的解決方法,我希望gradle插件的下一個測試版將最終解決它。無論如何非常感謝你agamov,我終於能夠發佈一個構建!乾杯! –

相關問題