I'm having trouble uploading my .apk to Google Play Store. I've previously been able to upload multiple different builds up to last week, but today I get the error that I should zipalign my file first.
EDIT: Normally, I was able to generate signed and zipaligned .apk's that the AppStore accepted by just using Android Studios built-in "Generate Signed APK" wizard. This did not work today, and led to the following:
I've tried the following:
Manual zipalign of the app-release.apk generated by Android studio. When I try this, I get the error "VERIFICATION FAILED" at the end. Some googling says that providing full path to a location where you have write-access is important, so I've tried doing it with the specific path, but to no avail:
./zipalign -v -f 4 /Users/<username>/git/<projectname>/app/app-release.apk /Users/<username>/git/<projectname>/app/aligned.apk
I then tried to download the APK Signer 1.8.5 and use that to zipalign the .apk - and behold, success! It creates an aligned apk, and i'm able to verify it using both Android Studio's own zipalign tool by
./zipalign -c -v 4 app-release_ALIGNED.apk
and the APK Signer itself. However, when uploading I now get the error:
Failed to run aapt dump badging:
W/ResourceType(208730): Bad resource table: header size 0x80a3 or total size 0x80b50000 is larger than data size 0x7bcc4
ERROR: dump failed because the resource table is invalid/corrupt.
This, I haven't been able to find solutions for.
I then tried to recreate the circumstances I was previously able to upload APKs from by reverting to a previous commit/build, as well as reverting from AS 2.2 preview 3 to AS2.2 preview 2, but again - no luck.
Finally, I tried explicitly adding
zipAlignEnabled true
to my release config in Gradle, but that didn't help either.
I'm out of suggestions, and hoping someone can help? :-) Thanks
Finally, eureka!
I randomly stumbled upon this line in my root build.gradle:
classpath 'com.android.tools.build:gradle:2.2.0-alpha3'
Android Studio 2.2 preview 3 requires this gradle build tool upgrade, and I had just pressed "sure, go ahead" as always. I got curious, and tried to change it back to what had worked last,
classpath 'com.android.tools.build:gradle:2.2.0-alpha2'
and built the project in Android Studio preview 2 instead - and voila, it worked! It seems there is a bug with the alpha3 build.
I hope this helps someone. I know I'm a happy friday-camper, that's for sure! :-)
Note to self: Don't rely on canary-builds for production apps in the future, no matter how much my friends and collegues push.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With