سؤال

I’ve installed an app I’ve written as a system app that after receiving ACTION_BOOT_COMPLETED it runs a service.

The app works just fine, however, I would like to disable it (and not remove it completely).

So I wrote on the command line “adb shell pm disable [The package name]” and after reboot, even though I do not see my app on the menu anymore, I still get a message “Unfortunately [myApp] has stopped”.

Logcat:

FATAL EXCEPTION: main 
E/AndroidRuntime( 1356): java.lang.RuntimeException: Unable to instantiate service [package name] : java.lang.ClassNotFoundException: Didn't find class "[packagename.classThatStartsTheService]" on path: /system/app/app.apk 
E/AndroidRuntime( 1356):    at android.app.ActivityThread.handleCreateService(ActivityThread.java:2516) 
E/AndroidRuntime( 1356):    at android.app.ActivityThread.access$1600(ActivityThread.java:144) 
E/AndroidRuntime( 1356):    at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1319) 
E/AndroidRuntime( 1356):    at android.os.Handler.dispatchMessage(Handler.java:99) 
E/AndroidRuntime( 1356):    at android.os.Looper.loop(Looper.java:137) 
E/AndroidRuntime( 1356):    at android.app.ActivityThread.main(ActivityThread.java:5074) 
E/AndroidRuntime( 1356):    at java.lang.reflect.Method.invokeNative(Native Method) 
E/AndroidRuntime( 1356):    at java.lang.reflect.Method.invoke(Method.java:511) 
E/AndroidRuntime( 1356):    at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:793) 
E/AndroidRuntime( 1356):    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:560) 
E/AndroidRuntime( 1356):    at dalvik.system.NativeStart.main(Native Method) 
E/AndroidRuntime( 1356): Caused by: java.lang.ClassNotFoundException: Didn't find class "[packagename.class that starts the service]" on path: /system/app/app.apk  
E/AndroidRuntime( 1356):    at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:65) 
E/AndroidRuntime( 1356):    at java.lang.ClassLoader.loadClass(ClassLoader.java:501) 
E/AndroidRuntime( 1356):    at java.lang.ClassLoader.loadClass(ClassLoader.java:461) 
E/AndroidRuntime( 1356):    at android.app.ActivityThread.handleCreateService(ActivityThread.java:2513) 
E/AndroidRuntime( 1356):    ... 10 more

Does that mean the boot_completed is still recognized by my app but because it is disabled it cannot run? Or is it something else?

Thanks in advance!

هل كانت مفيدة؟

المحلول

So, apparently I had another app that had the option to activate my app (only when choosing so and not by default), so after reboot, it couldn’t find it’s apk as it was disabled. So I disabled the second app as well.

مرخصة بموجب: CC-BY-SA مع الإسناد
لا تنتمي إلى StackOverflow
scroll top