我正在尝试使用Maven for Android自动构建我的 Android 应用程序。该应用程序具有标准的 Maven 文件夹格式,其中 src 位于src/main/java下,而测试位于src/test/java下。令人困惑的是,在执行命令时,mvn install
我的应用程序已编译,运行测试,构建报告为成功。
但是,在使用该命令在模拟器上部署和运行应用程序时,mvn android:deploy android:run
应用程序会启动,但在创建 Dagger 用于 DI 的对象图时会立即崩溃。例外状态;
06-30 17:31:08.626: E/AndroidRuntime(518): FATAL EXCEPTION: main
06-30 17:31:08.626: E/AndroidRuntime(518): java.lang.RuntimeException: Unable to create application com.oceanlife.MainApplication: java.lang.TypeNotPresentException: Type com.oceanlife.activity.AboutActivity not present
06-30 17:31:08.626: E/AndroidRuntime(518): at android.app.ActivityThread.handleBindApplication(ActivityThread.java:4247)
06-30 17:31:08.626: E/AndroidRuntime(518): at android.app.ActivityThread.access$3000(ActivityThread.java:125)
06-30 17:31:08.626: E/AndroidRuntime(518): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2071)
06-30 17:31:08.626: E/AndroidRuntime(518): at android.os.Handler.dispatchMessage(Handler.java:99)
06-30 17:31:08.626: E/AndroidRuntime(518): at android.os.Looper.loop(Looper.java:123)
06-30 17:31:08.626: E/AndroidRuntime(518): at android.app.ActivityThread.main(ActivityThread.java:4627)
06-30 17:31:08.626: E/AndroidRuntime(518): at java.lang.reflect.Method.invokeNative(Native Method)
06-30 17:31:08.626: E/AndroidRuntime(518): at java.lang.reflect.Method.invoke(Method.java:521)
06-30 17:31:08.626: E/AndroidRuntime(518): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:868)
06-30 17:31:08.626: E/AndroidRuntime(518): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:626)
06-30 17:31:08.626: E/AndroidRuntime(518): at dalvik.system.NativeStart.main(Native Method)
06-30 17:31:08.626: E/AndroidRuntime(518): Caused by: java.lang.TypeNotPresentException: Type com.oceanlife.activity.AboutActivity not present
06-30 17:31:08.626: E/AndroidRuntime(518): at java.lang.Class.getDeclaredAnnotations(Native Method)
06-30 17:31:08.626: E/AndroidRuntime(518): at java.lang.Class.getAnnotations(Class.java:322)
06-30 17:31:08.626: E/AndroidRuntime(518): at java.lang.Class.getAnnotation(Class.java:292)
06-30 17:31:08.626: E/AndroidRuntime(518): at dagger.internal.plugins.reflect.ReflectivePlugin.getModuleAdapter(ReflectivePlugin.java:51)
06-30 17:31:08.626: E/AndroidRuntime(518): at dagger.internal.RuntimeAggregatingPlugin.getModuleAdapter(RuntimeAggregatingPlugin.java:98)
06-30 17:31:08.626: E/AndroidRuntime(518): at dagger.internal.RuntimeAggregatingPlugin.getAllModuleAdapters(RuntimeAggregatingPlugin.java:55)
06-30 17:31:08.626: E/AndroidRuntime(518): at dagger.ObjectGraph.makeGraph(ObjectGraph.java:115)
06-30 17:31:08.626: E/AndroidRuntime(518): at dagger.ObjectGraph.create(ObjectGraph.java:103)
06-30 17:31:08.626: E/AndroidRuntime(518): at com.oceanlife.MainApplication.onCreate(MainApplication.java:36)
06-30 17:31:08.626: E/AndroidRuntime(518): at android.app.Instrumentation.callApplicationOnCreate(Instrumentation.java:969)
06-30 17:31:08.626: E/AndroidRuntime(518): at android.app.ActivityThread.handleBindApplication(ActivityThread.java:4244)
06-30 17:31:08.626: E/AndroidRuntime(518):
继我之前关于 Maven 与 Eclipse 与 Dagger 的问题之后,我开始期待ClassNotFound类型异常,因为各种构建系统都在与编译类应该存在的位置进行斗争。然而,我完全被这个难住了。
如果有帮助,我的 POM 就在这里...
提前谢谢你,任何想法都亲切地接受了。