Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

Android

Unable to successfully generate release-apk

Somewhere along the way while working on the first app Fun Fact project, I must have left the package name set to com.example. When I got to the step where I needed to upload the release-APK, it failed with an error that stated com.example was not available / couldn't be used.

I went in to the code for my Fun Fact application (FunFactActivity.java) and refactored the package name at the top from example to boursaw (my last name). This seemed to work but the release-apk still failed.

I then deleted the release-apk and rebuilt it, storing the ketstore and key in a totally new location and using a different name than previously used.

I continue to get the same error and am not sure what to do now. From the message window, I have captured the following.

Warning:can't write resource [.readme] (Duplicate zip entry [classes.jar:.readme]) :app:dexRelease :app:validateExternalOverrideSigning :app:packageRelease :app:zipalignRelease Unable to open 'C:\Users\Bob\AndroidStudioProjects\FunFacts\app\app-release.apk' as zip archive Error:Execution failed for task ':app:zipalignRelease'.

Process 'command 'C:\Users\Bob\AppData\Local\Android\sdk\build-tools\23.0.1\zipalign.exe'' finished with non-zero exit value 1

So I've found the following but am having some difficulty figuring out exactly what I'm supposed to do / what it is asking me to do. If anybody could assist me with this, I would greatly appreciate it.

Warning: can't write resource ... Duplicate zip entry Your input jars contain multiple resource files with the same name. ProGuard continues copying the resource files as usual, skipping any files with previously used names. Once more, the warning may be an indication of some problem though, so it's advisable to remove the duplicates. A convenient way to do so is by specifying filters on the input jars. There is no option to switch off these warnings. android The standard Android build process automatically specifies the input jars for you. There may not be an easy way to filter them to remove these warnings. You could remove the duplicate resource files manually from the input and the libraries.

ProGuard may terminate when it encounters parsing errors or I/O errors, or some more serious warnings:

1 Answer

The issue was that Windows had a lock on the file and Android Studio could not open the zip, resulting in an access denied error. I eventually shut everything down and tried to open the file with 7-zip and it sill failed, even with studio shut down. I then rebooted windows and went back to the same location to attempt to manually unzip it (just testing) and the file was no longer there following the reboot. I then regenerated the apk and everything worked fine.