Troubles installing programmatically an app with INSTALL_PACKAGES permission from /system/app

后端 未结 4 845
甜味超标
甜味超标 2020-12-16 16:36

I\'m trying to install programmatically an app without user interaction and i\'m getting this error

 SecurityException: Neither user 10057 nor current proces         


        
相关标签:
4条回答
  • 2020-12-16 16:47

    About the error:

    SecurityException: Neither user 10057 nor current process has android.permission.INSTALL_PACKAGES
    

    To get INSTALL_PACKAGES permission:

    1. Put your app in /system/app
    2. Sign the app with the system's key
    3. In the manifest.xml file, put this attribute inside the tag manifest:

      <manifest android:sharedUserId="android.uid.system" ...
      
    0 讨论(0)
  • 2020-12-16 16:51

    Running these two lines fixes the issue with PackageManager permission error: "Couldn't create temp file for downloaded package file."

    adb shell chown system.shell /data/app
    adb shell chown system.shell /data/local
    
    0 讨论(0)
  • 2020-12-16 16:54

    Refer to signatureOrSystem permissions on custom ROM

    Basically,

    1. add the required <uses-permission>
    2. push apk to /system/priv-app

    Done (well, at least works for me).

    You do not need to add android:protectionLevel="signatureOrSystem" or android:sharedUserId="android.uid.system". You could sign with any certification.

    0 讨论(0)
  • 2020-12-16 16:57

    I assume that putting it in the /system/app folder is not equivalent to it being loaded in the firmware.

    0 讨论(0)
提交回复
热议问题