[英]Permission denied causing “Installation failed due to invalid APK file”
When I try to run my app on my Nexus 4 running 4.2.1, I kept on getting this error in eclipse: 当我尝试在运行4.2.1的Nexus 4上运行我的应用程序时,我继续在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. 我厌倦了通过adb推送和安装,但它也没有用。 I figured out that it was because of this message in Logcat: 我发现这是因为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? 有关如何解决此问题的任何想法?
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. “权限被拒绝”的原因是上传到/ data / local / tmp的apk文件具有-rw -----权限并由root拥有,并且安装程序进程显然没有读取任何此类文件的权限。
I never found a solution, but have a workaround that satisfies me. 我从来没有找到解决方案,但有一个满足我的解决方法。 I have simply moved/symlinked the tmp directory to the SD card. 我只是将tmp目录移动/符号链接到SD卡。 Since SD card is formatted as FAT, it does not have owners/permissions and all files created there are always readable by everyone. 由于SD卡格式化为FAT,因此它没有所有者/权限,并且在那里创建的所有文件总是可供所有人阅读。
# cd /data/local
# mv tmp tmp-old # (or simply rm -rf tmp)
# mkdir /mnt/sdcard/tmp
# ln -s /mnt/sdcard/tmp ./tmp
What operating system are you using? 您使用什么操作系统? Perhaps your folder is lacking the appropriate permissions? 也许你的文件夹缺少相应的权限?
令人讨厌的是,关闭电话并重新打开电话的古老技巧再次起作用
如果您已在设备上使用具有相同程序包名称的已签名版本的应用程序,则可能需要在重新安装之前将其卸载(除非您要再次签名,然后将该已签名的应用程序上载到设备)。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.