我正在尝试从 Eclipse 切换到 IntelliJ IDEA 以进行 Android 开发。
目前我有一个依赖于 10 多个库(包括第三个库和 jars)的 Android 应用程序。
首先,当我尝试运行应用程序时,我收到了 Dalvik DEX 错误。我可以解决修改我的项目的依赖关系的范围,而不是我的。在我这样做之后,我得到了另一个错误,我不知道如何解决它......
03-11 16:10:10.423: ERROR/AndroidRuntime(10258): FATAL EXCEPTION: main
java.lang.RuntimeException: Unable to instantiate activity ComponentInfo{com.niula.loodic.android/com.niula.loodic.android.ui.HomeActivity}: java.lang.ClassNotFoundException: Didn't find class "com.niula.loodic.android.ui.HomeActivity" on path: /system/framework/com.google.android.maps.jar:/data/app/com.niula.loodic.android-1.apk
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2106)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2230)
at android.app.ActivityThread.access$600(ActivityThread.java:141)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1234)
at android.os.Handler.dispatchMessage(Handler.java:99)
at android.os.Looper.loop(Looper.java:137)
at android.app.ActivityThread.main(ActivityThread.java:5041)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:511)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:793)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:560)
at dalvik.system.NativeStart.main(Native Method)
Caused by: java.lang.ClassNotFoundException: Didn't find class "com.niula.loodic.android.ui.HomeActivity" on path: /system/framework/com.google.android.maps.jar:/data/app/com.niula.loodic.android-1.apk
at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:65)
at java.lang.ClassLoader.loadClass(ClassLoader.java:501)
at java.lang.ClassLoader.loadClass(ClassLoader.java:461)
at android.app.Instrumentation.newActivity(Instrumentation.java:1054)
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2097)
为什么会这样?
Didn't find class "com.niula.loodic.android.ui.HomeActivity" on path: /system/framework/com.google.android.maps.jar:/data/app/com.niula.loodic.android-1.apk
欢迎任何帮助,我无法附上一些图片,因为我不知道问题的根源。实际上我从编辑器中收到了一些奇怪的错误,因为 Google Maps V2.
http://imageshack.us/f/199/captura1.png/ http://imageshack.us/f/708/captura2zt.png/ http://imageshack.us/f/571/captura3h.png/ http: //imageshack.us/f/835/captura4qk.png/
提前致谢
编辑:如果我将所有模块(库)依赖项“范围”更改为“编译”,这是我在 DEX 执行期间遇到的错误:
Android Dex: [loodic] java.lang.IllegalArgumentException: already added: Landroid/support/v4/accessibilityservice/AccessibilityServiceInfoCompat;