赞
踩
我读过大约一百个相同类别的问题,但没有一个有用.我有一个正在运行的应用程序,然后重构了程序包名称,并进行了编译和运行.一周后,我回到工作上,并在启动时获取ClassNotFoundException.更糟糕的是,如果我从存储库中检出先前的提交(在任何重构之前,其中所有工作都起作用),则该项目在启动时会引发相同的错误(除非使用不同的程序包名称).
我已经尽力想了一切,但我不知道如何找到问题所在.我已经做了明显的事情:清理项目,将其完全删除并重新添加,在新设备上运行…
我不确定哪种代码将有助于调试,但这是清单中的声明和logcat输出.如果还有其他用处,请告诉我.我真的在这里迷路了.
崩溃:
E/AndroidRuntime( 515): FATAL EXCEPTION: main
E/AndroidRuntime( 515): java.lang.RuntimeException: Unable to instantiate service
co.mosic.mosic.CommunicationService: java.lang.ClassNotFoundException: co.mosic.mosic.CommunicationService
E/AndroidRuntime( 515): at android.app.ActivityThread.handleCreateService(ActivityThread.java:2237)
E/AndroidRuntime( 515): at android.app.ActivityThread.access$1600(ActivityThread.java:123)
E/AndroidRuntime( 515): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1201)
E/AndroidRuntime( 515): at android.os.Handler.dispatchMessage(Handler.java:99)
E/AndroidRuntime( 515): at android.os.Looper.loop(Looper.java:137)
E/AndroidRuntime( 515): at android.app.ActivityThread.main(ActivityThread.java:4424)
E/AndroidRuntime( 515): at java.lang.reflect.Method.invokeNative(Native Method)
E/AndroidRuntime( 515): at java.lang.reflect.Method.invoke(Method.java:511)
E/AndroidRuntime( 515): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:784)
E/AndroidRuntime( 515): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:551)
E/AndroidRuntime( 515): at dalvik.system.NativeStart.main(Native Method)
E/AndroidRuntime( 515): Caused by: java.lang.ClassNotFoundException: co.mosic.mosic.CommunicationService
E/AndroidRuntime( 515): at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:61)
E/AndroidRuntime( 515): at java.lang.ClassLoader.loadClass(ClassLoader.java:501)
E/AndroidRuntime( 515): at java.lang.ClassLoader.loadClass(ClassLoader.java:461)
E/AndroidRuntime( 515): at android.app.ActivityThread.handleCreateService(ActivityThread.java:2234)
E/AndroidRuntime( 515): ... 10 more
表现:
package="co.mosic.mosic"
android:versionCode="1"
android:versionName="1.0" >
...
android:name=".CommunicationService" >
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。