Question

For some reason android studio is not compiling my apk. I get these messages:

Error: C:\Users\<USER>\git\<project>\app\build\apk\<app_name>.apk (The system cannot find the path specified)

followed by

Error: 
Unable to open 'C:\Users\<User>\AppData\Local\Temp\android75(...).apk' as zip archive

This is only happening for one of the projects the other one compiles fine and both project have almost identical configurations. Any help will be greatly appreciated :)

Was it helpful?

Solution 2

The only thing I found that worked was to reinstall Android Studio.

If you are having this issue, completely uninstall Android Studio (if installed) via control panel uninstall (or using uninstall software)

and

REMOVE the .AndroidStudioPreview folder in your C:\Users\ directory

Then go ahead and grab the latest release of Android Studio from http://tools.android.com/recent and use this.

It solved the problem for me when all else failed.

OTHER TIPS

Clean project (Build -> clean project) and then, run your project into a device. This action creates a apk folder needed.

This might sound crazy but here's what worked for me:

Ensure that the project root is highlighted (selected) in the Project tab, not any of your library modules!

Here is what I did, which seemed to work without re-installing.

  1. Create an empty file in the filename (and path) of the APK that it is not finding.
  2. Build the APK file, you should note that the generated APK will be very small, and not an actual valid APK file.
  3. Delete that file
  4. In Android Studio, go to File -> Invalidate Caches / Restart...
  5. Choose Invalidate and Restart
  6. Build the APK file, which should now be valid.

Let me know if this works for anyone else.

So the solution here might be: wait until Android Studio is fixed, or submit a patch yourself.

I'm having the same issue ... I've tried running these targets with no effect:

clean assembleRelease assembleDebug

In addition I've tried cleaning and building the project from the menu (Build->Clean Project, Build->Make Project). And after that I ran the targets assembleRelease and assembleDebug.

I got the .apk file to be generated once. Now it won't regenerate.

If Android Studio weren't in beta I'd have a fit right about now. Wait ... I AM having a fit.

Generating an .apk is really kind of a basic thing the IDE should be doing every time. But that's just my opinion.

This happened to me because I had some kind of weird file in my "assets" directory. Maybe it was a zip file, and zipalign got confused with zips within zips??? Or, maybe it was too large: it was generating an APK that was like 180MB.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top