Open shesio opened 8 years ago
@asLody 我也遇到同样的问题:Caused by: java.lang.NoClassDefFoundError: Class not found using the boot class loader; no stack available
是不是有多个dex?
需要将框架AndroidManifest.xml文件中的权限,预注册的组件,移动到主程序中的AndroidManifest.xml文件
j额,为什么我把框架中的权限和预注册的组件移动到主程序中后,它就报合并清单文件出错了,这个怎么办?明明没有相同的属性啊Error:Execution failed for task ':app:processDebugManifest'.
Manifest merger failed with multiple errors, see logs
好吧,现在不会报合并清单文件出错了,需要将插件工程中build.gradle文件中使用到的defaultConfig中的那些authorityName都复制到主工程中的buuild中去,我是将整个defaultConfig都复制过去的,因为我主工程中没有defaultConfig的属性的,但是依然在打开插件时报ClassNotFound啊啊啊啊啊
03-09 18:08:49.009 25560-25560/? E/AndroidRuntime: FATAL EXCEPTION: main Process: com.airmedia_commute.passenger, PID: 25560 java.lang.RuntimeException: Unable to get provider com.morgoo.droidplugin.stub.ContentProviderStub$StubP00: java.lang.ClassNotFoundException: Didn't find class "com.morgoo.droidplugin.stub.ContentProviderStub$StubP00" on path: DexPathList[[zip file "/data/app/com.airmedia_commute.passenger-1.apk"],nativeLibraryDirectories=[/data/app-lib/com.airmedia_commute.passenger-1, /vendor/lib, /system/lib]] at android.app.ActivityThread.installProvider(ActivityThread.java:4889) at android.app.ActivityThread.installContentProviders(ActivityThread.java:4481) at android.app.ActivityThread.handleBindApplication(ActivityThread.java:4421) at android.app.ActivityThread.access$1500(ActivityThread.java:141) at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1272) at android.os.Handler.dispatchMessage(Handler.java:102) at android.os.Looper.loop(Looper.java:136) at android.app.ActivityThread.main(ActivityThread.java:5113) at java.lang.reflect.Method.invokeNative(Native Method) at java.lang.reflect.Method.invoke(Method.java:515) at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:796) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:612) at dalvik.system.NativeStart.main(Native Method) Caused by: java.lang.ClassNotFoundException: Didn't find class "com.morgoo.droidplugin.stub.ContentProviderStub$StubP00" on path: DexPathList[[zip file "/data/app/com.airmedia_commute.passenger-1.apk"],nativeLibraryDirectories=[/data/app-lib/com.airmedia_commute.passenger-1, /vendor/lib, /system/lib]] at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:56) at java.lang.ClassLoader.loadClass(ClassLoader.java:497) at java.lang.ClassLoader.loadClass(ClassLoader.java:457) at android.app.ActivityThread.installProvider(ActivityThread.java:4874) at android.app.ActivityThread.installContentProviders(ActivityThread.java:4481) at android.app.ActivityThread.handleBindApplication(ActivityThread.java:4421) at android.app.ActivityThread.access$1500(ActivityThread.java:141) at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1272) at android.os.Handler.dispatchMessage(Handler.java:102) at android.os.Looper.loop(Looper.java:136) at android.app.ActivityThread.main(ActivityThread.java:5113) at java.lang.reflect.Method.invokeNative(Native Method) at java.lang.reflect.Method.invoke(Method.java:515) at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:796) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:612) at dalvik.system.NativeStart.main(Native Method) 我这里也报类找不到,在6.0手机可以运行,在我红米4.4.4手机上,打不开,看Log报这个异常。
我测试时候发现当生成的apk里有多个dex时,会出现ClassNotFoundException,在build.gradle
里把multiDexEnabled
设置成false
可以(暂时)解决这个问题。
android {
defaultConfig {
...
multiDexEnabled = false
}
}
DroidPlugin\project\Libraries\DroidPlugin\src\main\java\com\morgoo\droidplugin\hook\handle\PluginCallback.java 的line 368
if (targetComponentName != null && targetComponentName.getClassName().startsWith("")) { targetIntent.setClassName(targetComponentName.getPackageName(), targetComponentName.getPackageName() + targetComponentName.getClassName()); }
的.startsWith("") 改.startsWith(".")
找不到类,这是怎么回事? FATAL EXCEPTION: main Process: com.hiquanta.logisticsapp:PluginP05, PID: 10901 java.lang.RuntimeException: Unable to instantiate activity ComponentInfo{com.hiquanta.eduapp/com.hiquanta.eduappcom.hiquanta.eduapp.AppStart}: java.lang.ClassNotFoundException: Didn't find class "com.hiquanta.eduappcom.hiquanta.eduapp.AppStart" on path: DexPathList[[zip file "/data/data/com.hiquanta.logisticsapp/Plugin/com.hiquanta.eduapp/apk/base-1.apk"],nativeLibraryDirectories=[/data/data/com.hiquanta.logisticsapp/Plugin/com.hiquanta.eduapp/lib, /vendor/lib, /system/lib]] at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2236) at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2387) at android.app.ActivityThread.access$800(ActivityThread.java:151) at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1303) at android.os.Handler.dispatchMessage(Handler.java:102) at android.os.Looper.loop(Looper.java:135) at android.app.ActivityThread.main(ActivityThread.java:5254) 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:903) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:698) Caused by: java.lang.ClassNotFoundException: Didn't find class "com.hiquanta.eduappcom.hiquanta.eduapp.AppStart" on path: DexPathList[[zip file "/data/data/com.hiquanta.logisticsapp/Plugin/com.hiquanta.eduapp/apk/base-1.apk"],nativeLibraryDirectories=[/data/data/com.hiquanta.logisticsapp/Plugin/com.hiquanta.eduapp/lib, /vendor/lib, /system/lib]] at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:56) at java.lang.ClassLoader.loadClass(ClassLoader.java:511) at com.morgoo.droidplugin.core.PluginClassLoader.loadClass(PluginClassLoader.java:74) at java.lang.ClassLoader.loadClass(ClassLoader.java:469) at android.app.Instrumentation.newActivity(Instrumentation.java:1066) at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2226) at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2387) at android.app.ActivityThread.access$800(ActivityThread.java:151) at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1303) at android.os.Handler.dispatchMessage(Handler.java:102) at android.os.Looper.loop(Looper.java:135) at android.app.ActivityThread.main(ActivityThread.java:5254) 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:903) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:698) Suppressed: java.lang.ClassNotFoundException: com.hiquanta.eduappcom.hiquanta.eduapp.AppStart 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) ... 14 more Caused by: java.lang.NoClassDefFoundError: Class not found using the boot class loader; no stack available