Skip to main content
replaced http://android.stackexchange.com/ with https://android.stackexchange.com/
Source Link
removed unnecessary info + proofread
Source Link
Aloha
  • 345
  • 2
  • 7
  • 19

Lollipop and above - How do I install an appAPK as a system app?

How do I install an app as a system app on Lollipop 5.1.x? I suspect something's up with SELinux and context, but I don't have root access. However, I have read/write access to the filesystem (by mounting the image in Linux).


Steps I did (since I don't have root, su binary PIE error):

  • Make a NAND image of the phone
  • Mount it on Linux
  • Copy the APK files to either app or priv-app. I've already tried them both.
  • Double-check if permissions are correct
  • Dismount and burn to phone
  • Clear data and cache
  • All of the apps I've installed force closes
  • Their package names and the generic logo shows up on the launcerlauncher instead of their app name and logo
  • They simply don't work

Lollipop - How do I install an app as a system app?

How do I install an app as a system app on Lollipop 5.1.x? I suspect something's up with SELinux and context, but I don't have root access. However, I have read/write access to the filesystem (by mounting the image in Linux).


Steps I did (since I don't have root, su binary PIE error):

  • Make a NAND image of the phone
  • Mount it on Linux
  • Copy the APK files to either app or priv-app. I've already tried them both.
  • Double-check if permissions are correct
  • Dismount and burn to phone
  • Clear data and cache
  • All of the apps I've installed force closes
  • Their package names and the generic logo shows up on the launcer instead of their app name and logo
  • They simply don't work

Lollipop and above - How do I install an APK as a system app?

How do I install an app as a system app on Lollipop? I suspect something's up with SELinux and context, but I don't have root access. However, I have read/write access to the filesystem (by mounting the image in Linux).

  • All of the apps I've installed force closes
  • Their package names and the generic logo shows up on the launcher instead of their app name and logo
  • They simply don't work
Tweeted twitter.com/StackAndroid/status/793235387741339648
added 5118 characters in body
Source Link
Aloha
  • 345
  • 2
  • 7
  • 19

UPDATE: I've tried Death Mask Salesman's suggestion and taken a look at logcat. The apps I want to pre-install (e.g. Instagram) are throwing this error:

01-01 01:04:45.108 5538-5538/? E/AndroidRuntime: FATAL EXCEPTION: main
                                                 Process: com.instagram.android, PID: 5538
                                                 java.lang.RuntimeException: Unable to instantiate application com.instagram.app.InstagramAppShell: java.lang.ClassNotFoundException: Didn't find class "com.instagram.app.InstagramAppShell" on path: DexPathList[[zip file "/system/framework/com.google.android.maps.jar"],nativeLibraryDirectories=[/custpack/app/removeable/withlibs/com.instagram.android-1/lib/arm, /vendor/lib, /system/lib]]
                                                     at android.app.LoadedApk.makeApplication(LoadedApk.java:572)
                                                     at android.app.ActivityThread.handleBindApplication(ActivityThread.java:4818)
                                                     at android.app.ActivityThread.access$1500(ActivityThread.java:178)
                                                     at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1531)
                                                     at android.os.Handler.dispatchMessage(Handler.java:111)
                                                     at android.os.Looper.loop(Looper.java:194)
                                                     at android.app.ActivityThread.main(ActivityThread.java:5624)
                                                     at java.lang.reflect.Method.invoke(Native Method)
                                                     at java.lang.reflect.Method.invoke(Method.java:372)
                                                     at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:959)
                                                     at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:754)
                                                  Caused by: java.lang.ClassNotFoundException: Didn't find class "com.instagram.app.InstagramAppShell" on path: DexPathList[[zip file "/system/framework/com.google.android.maps.jar"],nativeLibraryDirectories=[/custpack/app/removeable/withlibs/com.instagram.android-1/lib/arm, /vendor/lib, /system/lib]]
                                                     at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:56)
                                                     at java.lang.ClassLoader.loadClass(ClassLoader.java:511)
                                                     at java.lang.ClassLoader.loadClass(ClassLoader.java:469)
                                                     at android.app.Instrumentation.newApplication(Instrumentation.java:985)
                                                     at android.app.LoadedApk.makeApplication(LoadedApk.java:567)
                                                     at android.app.ActivityThread.handleBindApplication(ActivityThread.java:4818) 
                                                     at android.app.ActivityThread.access$1500(ActivityThread.java:178) 
                                                     at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1531) 
                                                     at android.os.Handler.dispatchMessage(Handler.java:111) 
                                                     at android.os.Looper.loop(Looper.java:194) 
                                                     at android.app.ActivityThread.main(ActivityThread.java:5624) 
                                                     at java.lang.reflect.Method.invoke(Native Method) 
                                                     at java.lang.reflect.Method.invoke(Method.java:372) 
                                                     at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:959) 
                                                     at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:754) 
                                                    Suppressed: java.lang.ClassNotFoundException: com.instagram.app.InstagramAppShell
                                                     at java.lang.Class.classForName(Native Method)
                                                     at java.lang.BootClassLoader.findClass(ClassLoader.java:781)
                                                     at java.lang.BootClassLoader.loadClass(ClassLoader.java:841)
                                                     at java.lang.ClassLoader.loadClass(ClassLoader.java:504)
                                                            ... 13 more
                                                  Caused by: java.lang.NoClassDefFoundError: Class not found using the boot class loader; no stack available

UPDATE: I've tried Death Mask Salesman's suggestion and taken a look at logcat. The apps I want to pre-install (e.g. Instagram) are throwing this error:

01-01 01:04:45.108 5538-5538/? E/AndroidRuntime: FATAL EXCEPTION: main
                                                 Process: com.instagram.android, PID: 5538
                                                 java.lang.RuntimeException: Unable to instantiate application com.instagram.app.InstagramAppShell: java.lang.ClassNotFoundException: Didn't find class "com.instagram.app.InstagramAppShell" on path: DexPathList[[zip file "/system/framework/com.google.android.maps.jar"],nativeLibraryDirectories=[/custpack/app/removeable/withlibs/com.instagram.android-1/lib/arm, /vendor/lib, /system/lib]]
                                                     at android.app.LoadedApk.makeApplication(LoadedApk.java:572)
                                                     at android.app.ActivityThread.handleBindApplication(ActivityThread.java:4818)
                                                     at android.app.ActivityThread.access$1500(ActivityThread.java:178)
                                                     at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1531)
                                                     at android.os.Handler.dispatchMessage(Handler.java:111)
                                                     at android.os.Looper.loop(Looper.java:194)
                                                     at android.app.ActivityThread.main(ActivityThread.java:5624)
                                                     at java.lang.reflect.Method.invoke(Native Method)
                                                     at java.lang.reflect.Method.invoke(Method.java:372)
                                                     at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:959)
                                                     at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:754)
                                                  Caused by: java.lang.ClassNotFoundException: Didn't find class "com.instagram.app.InstagramAppShell" on path: DexPathList[[zip file "/system/framework/com.google.android.maps.jar"],nativeLibraryDirectories=[/custpack/app/removeable/withlibs/com.instagram.android-1/lib/arm, /vendor/lib, /system/lib]]
                                                     at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:56)
                                                     at java.lang.ClassLoader.loadClass(ClassLoader.java:511)
                                                     at java.lang.ClassLoader.loadClass(ClassLoader.java:469)
                                                     at android.app.Instrumentation.newApplication(Instrumentation.java:985)
                                                     at android.app.LoadedApk.makeApplication(LoadedApk.java:567)
                                                     at android.app.ActivityThread.handleBindApplication(ActivityThread.java:4818) 
                                                     at android.app.ActivityThread.access$1500(ActivityThread.java:178) 
                                                     at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1531) 
                                                     at android.os.Handler.dispatchMessage(Handler.java:111) 
                                                     at android.os.Looper.loop(Looper.java:194) 
                                                     at android.app.ActivityThread.main(ActivityThread.java:5624) 
                                                     at java.lang.reflect.Method.invoke(Native Method) 
                                                     at java.lang.reflect.Method.invoke(Method.java:372) 
                                                     at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:959) 
                                                     at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:754) 
                                                    Suppressed: java.lang.ClassNotFoundException: com.instagram.app.InstagramAppShell
                                                     at java.lang.Class.classForName(Native Method)
                                                     at java.lang.BootClassLoader.findClass(ClassLoader.java:781)
                                                     at java.lang.BootClassLoader.loadClass(ClassLoader.java:841)
                                                     at java.lang.ClassLoader.loadClass(ClassLoader.java:504)
                                                            ... 13 more
                                                  Caused by: java.lang.NoClassDefFoundError: Class not found using the boot class loader; no stack available
Source Link
Aloha
  • 345
  • 2
  • 7
  • 19
Loading