Galaxy S3 app debugging: unable to open zip archive. Permission denied

android, eclipse

Solution

https://stackoverflow.com/a/14890187/1155151

This answer solved the same issue for me on my Galaxy S3

If you have rooted your phone then there can be an issue where the data/local/tmp directory has -rw----- permission and is owned by root and the installer process has insufficient permissions. Creating a symlink bypasses this problem as permissions on this folder appear to be overridden at some point.

# cd /data/local
# mv tmp tmp-old # (or simply rm -rf tmp)
# mkdir /mnt/sdcard/tmp
# ln -s /mnt/sdcard/tmp ./tmp

Problem

USB debugging is enabled, installing non-market apps is enabled, and my device is recognized properly in Eclipse. But when I try to run my app with my phone connected, I get: ``` [2012-12-26 19:07:38 - TestApp] Installing TestApp.apk... [2012-12-26 19:07:39 - TestApp] Installation failed due to invalid APK file! [2012-12-26 19:07:39 - TestApp] Please check logcat output for more details. [2012-12-26 19:07:39 - TestApp] Launch canceled! ``` LogCat shows this: ``` Unable to open Zip archive 'data/local/tmp/TestApp.apk': Permission Denied failed to open Zip archive 'data/local/tmp/TestApp.apk' ``` I googled for a while and couldn't find anything that worked as a solution, but I just don't know what's going on. Someone said to start an adb shell and use chmod 777 /data. Tried that for the hell of it, but it was no use. Someone else said it might be a custom ROM issue, so I reverted to rooted stock and it's still giving me the same problems. I've also tried cleaning the project with Eclipse, rebooting everything and deleting my .android folder. I'm completely at a loss. Does anyone have any idea what might be going on? EDIT: The app also installs just fine if I email it to myself and install it through the gmail app.

Original source