2

When I try to run my app on my Nexus 4 running 4.2.1, I kept on getting this error in eclipse:

[2012-12-22 19:30:51 - Rhiokai] Installation failed due to invalid APK file!
[2012-12-22 19:30:51 - Rhiokai] Please check logcat output for more details.
[2012-12-22 19:30:51 - Rhiokai] Launch canceled!

I tired pushing and installing via adb but it didn't work either. I figured out that it was because of this message in Logcat:

12-22 19:37:29.326: W/zipro(7371): Unable to open zip '/data/local/tmp/Rhiokai.apk': Permission denied
12-22 19:37:29.326: D/asset(7371): failed to open Zip archive '/data/local/tmp/Rhiokai.apk'

Any ideas on how to fix this issue?

Rhiokai
  • 2,147
  • 5
  • 16
  • 18
  • What operating system are you using? Perhaps your folder is lacking the appropriate permissions? – lynvie Dec 23 '12 at 22:26

2 Answers2

22

I started receiving this error after rooting my phone.

The reason for "permission denied" is that apk files uploaded to /data/local/tmp had the -rw----- permission and owned by root, and the installer process obviously did not have permissions to read any such file.

I never found a solution, but have a workaround that satisfies me. I have simply moved/symlinked the tmp directory to the SD card. Since SD card is formatted as FAT, it does not have owners/permissions and all files created there are always readable by everyone.

# cd /data/local
# mv tmp tmp-old # (or simply rm -rf tmp)
# mkdir /mnt/sdcard/tmp
# ln -s /mnt/sdcard/tmp ./tmp
Gena Batsyan
  • 736
  • 5
  • 14
0

Annoyingly, the age old trick of turning the phone off and back on again worked

Rhiokai
  • 2,147
  • 5
  • 16
  • 18