Permission denied causing “Installation failed due

2020-02-29 11:28发布

问题:

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?

回答1:

If you already have a signed version of the application on the device with the same package name, you might need to uninstall it before re-installing it (unless you want to sign it again and then upload that signed app to the device).



回答2:

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


回答3:

What operating system are you using? Perhaps your folder is lacking the appropriate permissions?



回答4:

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



标签: java android adb