root过了手机,发现再次安装程序出现了 Installation failed due to invalid APK file

这样的错误,后来再看logcat 发现是

Unable to open zip '/data/local/tmp/QuanZi.apk': Permission denied

这样的原因,但是将data/local/tmp 的权限修改了发现还是不行,最后通过查找,发现使用软连接的方式,将/data/local/tmp 到 /mnt/sdcard/tmp 这个下面,发现就可以了,也就是以后我的这个手机程序的安装都首先要在sdcard下安装了


ln -s /mnt/sdcard/tmp /data/local/tmp 下面的查找的资料


I got exactly the same problem, and this solution fixed it, so i hope it does for you too.

The reason for "permission denied" is that apk files uploaded to /data/local/tmp had to low permissions, 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. So open a terminal emulator on your phone. Get root ("su") and type in:

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