Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Android Studio Preview 3 error when generating release APK : release-stripped.ap_ does not exist

I updated Android studio from Preview 2 to Preview 3 and now I get this error when I try to generate a release APK:

Error:A problem was found with the configuration of task ':app:packageProdRelease'.
> File '/Users/jay/repositories/test/app/build/intermediatesError:A problem was found with the configuration of task ':app:packageProdRelease'.
> File '/Users/jay/repositories/test/app/build/intermediates/res/resources-prod-release-stripped.ap_' specified for property 'resourceFile' does not exist.

I've read that it might be related to instant run feature so I disabled it and still the same error. And then, I tried to set shrinkResources attribute to false and then It works. BUT when I tried uploading the apk in Google Developper Console, it says my apk is not Zipaligned...

Wherever you are Google Developper, Help me out! :O

like image 959
Jaythaking Avatar asked Jun 09 '16 19:06

Jaythaking


1 Answers

This problem occurs to me if I am using gradle 2.2.0-alpha3. I found a workaround to this problem. You can solve this by disabling shrinkResources and zipalign in gradle and then run zipalign using command line.

build.gradle:

shrinkResources false
zipAlignEnabled false

Run the zipalign command manually:

<your-android-sdk-path>/sdk/build-tools/23.0.3$ 
./zipalign -v 4 <your-input>.apk <your-output>.apk

Edit:

I just have a try on using older version of gradle 2.1.0, it works without this problem. zipalign problem in gradle 2.2.0-alpha3 is mentioned in this SO thread as well.

like image 196
chubao Avatar answered Sep 27 '22 20:09

chubao