Android development RecoverySystem.installPackage() cannot write to /cache/recovery/command permission denied

前端 未结 5 1659
陌清茗
陌清茗 2020-12-10 03:42

I have been asked to write a small simple app for an Android-based product. The device comes with two Android system images with different features. The app I\'m writing is

5条回答
  •  情歌与酒
    2020-12-10 04:12

    Before when my app was installed in /system/app I was getting below error:

    07-20 10:52:46.512      933-951/? W/RecoverySystem﹕ !!! REBOOTING TO INSTALL /storage/emulated/legacy/Download/Update.zip !!!
    07-20 10:52:46.512      933-951/? W/System.err﹕ java.io.FileNotFoundException: /cache/recovery/command: open failed: EACCES (Permission denied)
    07-20 10:52:46.512      933-951/? W/System.err﹕ at libcore.io.IoBridge.open(IoBridge.java:409)
    07-20 10:52:46.512      933-951/? W/System.err﹕ at java.io.FileOutputStream.(FileOutputStream.java:88)
    07-20 10:52:46.512      933-951/? W/System.err﹕ at java.io.FileOutputStream.(FileOutputStream.java:73)
    07-20 10:52:46.512      933-951/? W/System.err﹕ at java.io.FileWriter.(FileWriter.java:42)
    07-20 10:52:46.512      933-951/? W/System.err﹕ at android.os.RecoverySystem.bootCommand(RecoverySystem.java:389)
    07-20 10:52:46.522      933-951/? W/System.err﹕ at android.os.RecoverySystem.installPackage(RecoverySystem.java:337)
    

    I had tried all permissions that were required but I couldn't proceed.

    So then since I was using API above 4.2 I tried to put my app into /system/priv-app and it worked for me.

提交回复
热议问题