Android - maven - 构建错误

发布于 2024-12-02 21:11:57 字数 4687 浏览 0 评论 0原文

maven-plugin,构建成功,但是当我尝试 mvn clean install 时,我得到了这个日志

[INFO] Reloading plugin container for: org.apache.maven.plugins:maven-clean-plugin. The plugin artifact has changed.

[INFO] [clean:clean] [INFO] 删除文件集:distrib(包含:[.],排除:[]) [INFO] 重新加载插件容器:org.apache.maven.plugins:maven-antrun-plugin。插件工件已更改。 [信息] 重新加载插件容器:org.apache.maven.plugins:maven-changes-plugin。插件工件已更改。 [信息] 重新加载插件容器:org.apache.maven.plugins:maven-eclipse-plugin。插件工件已更改。 [信息] 重新加载插件容器:com.atlassian.maven.plugins:maven-clover2-plugin。插件工件已更改。 [信息] 重新加载插件容器:org.apache.maven.plugins:maven-surefire-plugin。插件工件已更改。 [信息] 重新加载插件容器:org.apache.maven.plugins:maven-compiler-plugin。插件工件已更改。 [信息] 重新加载插件容器:org.apache.maven.plugins:maven-ejb-plugin。插件工件已更改。 [信息] 重新加载插件容器:org.apache.maven.plugins:maven-jar-plugin。插件工件已更改。 [信息] 重新加载插件容器:org.apache.maven.plugins:maven-war-plugin。插件工件已更改。 [信息] 重新加载插件容器:org.apache.maven.plugins:maven-pmd-plugin。插件工件已更改。 [信息] 重新加载插件容器:org.apache.maven.plugins:maven-assemble-plugin。插件工件已更改。 [信息] 重新加载插件容器:org.apache.maven.plugins:maven-clean-plugin。插件工件已更改。 [信息] 重新加载插件容器:org.apache.maven.plugins:maven-release-plugin。插件工件已更改。 [信息] 重新加载插件容器:org.apache.maven.plugins:maven-javadoc-plugin。插件工件已更改。 [信息] 重新加载插件容器:org.apache.maven.plugins:maven-site-plugin。插件工件已更改。 [信息] 重新加载插件容器:org.apache.maven.plugins:maven-install-plugin。插件工件已更改。 [信息] [站点:附加描述符] [信息] [安装:安装] [信息] 安装 D:\RSM\mobile\fd-mobile-android\pom.xml 到 C:\Users\hkhwileh.m2\repository\com\firstderivatives\rsm\mobile\android\fd-mobile-androi d-parent\5.4-SNAPSHOT\fd-mobile-android-parent-5.4-SNAPSHOT.pom [信息] ---------------------------------------------------------- -------------------------

[ERROR] Cannot create the APKBuilder object

com.android.sdklib.build.ApkCreationException: java.io.FileNotFoundException: D:\RSM\mobile\fd- mobile-android\application\target\classes.dex 没有 存在 在 com.android.sdklib.build.ApkBuilder.init(ApkBuilder.java:455) 在 com.android.sdklib.build.ApkBuilder.(ApkBuilder.java:386) 在 sun.reflect.NativeConstructorAccessorImpl.newInstance0(本机方法) 在 sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:39) 在 sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:27) 在 java.lang.reflect.Constructor.newInstance(Constructor.java:513) 在 com.jayway.maven.plugins.android.phase09package.ApkBuilder.(ApkBuilder.java:197) 在 com.jayway.maven.plugins.android.phase09package.ApkMojo.doAPKWithAPKBuilder(ApkMojo.java:206) 在 com.jayway.maven.plugins.android.phase09package.ApkMojo.createApkFile(ApkMojo.java:171) 在 com.jayway.maven.plugins.android.phase09package.ApkMojo.execute(ApkMojo.java:144) 在org.apache.maven.plugin.DefaultPluginManager.executeMojo(DefaultPluginManager.java:451) 在org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoals(DefaultLifecycleExecutor.java:558) 在org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoalWithLifecycle(DefaultLifecycleExecutor.java:499) 在org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoal(DefaultLifecycleExecutor.java:478) 在org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoalAndHandleFailures(DefaultLifecycleExecutor.java:330) 在org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeTaskSegments(DefaultLifecycleExecutor.java:291) 在 org.apache.maven.lifecycle.DefaultLifecycleExecutor.execute(DefaultLifecycleExecutor.java:142) 在 org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:336) 在 org.apache.maven.DefaultMaven.execute(DefaultMaven.java:129) 在 org.apache.maven.cli.MavenCli.main(MavenCli.java:287) 在 sun.reflect.NativeMethodAccessorImpl.invoke0(本机方法) 在 sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) 在 sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) 在 java.lang.reflect.Method.invoke(Method.java:597) 在 org.codehaus.classworlds.Launcher.launchEnhanced(Launcher.java:315) 在 org.codehaus.classworlds.Launcher.launch(Launcher.java:255) 在 org.codehaus.classworlds.Launcher.mainWithExitCode(Launcher.java:430) 在 org.codehaus.classworlds.Launcher.main(Launcher.java:375) 引起原因:java.io.FileNotFoundException:D:\RSM\mobile\fd-mobile-android\application\target\classes.dex不存在 在 com.android.sdklib.build.ApkBuilder.checkInputFile(ApkBuilder.java:828) 在 com.android.sdklib.build.ApkBuilder.init(ApkBuilder.java:432) ... 27 更多

和尾巴 所以任何人都可以帮助我

maven-plugin , the build is success , but the when i try mvn clean install i got this logs

[INFO] Reloading plugin container for: org.apache.maven.plugins:maven-clean-plugin. The plugin artifact has changed.

[INFO] [clean:clean]
[INFO] Deleting file-set: distrib (included: [.], excluded: [])
[INFO] Reloading plugin container for: org.apache.maven.plugins:maven-antrun-plugin. The plugin artifact has changed.
[INFO] Reloading plugin container for: org.apache.maven.plugins:maven-changes-plugin. The plugin artifact has changed.
[INFO] Reloading plugin container for: org.apache.maven.plugins:maven-eclipse-plugin. The plugin artifact has changed.
[INFO] Reloading plugin container for: com.atlassian.maven.plugins:maven-clover2-plugin. The plugin artifact has changed.
[INFO] Reloading plugin container for: org.apache.maven.plugins:maven-surefire-plugin. The plugin artifact has changed.
[INFO] Reloading plugin container for: org.apache.maven.plugins:maven-compiler-plugin. The plugin artifact has changed.
[INFO] Reloading plugin container for: org.apache.maven.plugins:maven-ejb-plugin. The plugin artifact has changed.
[INFO] Reloading plugin container for: org.apache.maven.plugins:maven-jar-plugin. The plugin artifact has changed.
[INFO] Reloading plugin container for: org.apache.maven.plugins:maven-war-plugin. The plugin artifact has changed.
[INFO] Reloading plugin container for: org.apache.maven.plugins:maven-pmd-plugin. The plugin artifact has changed.
[INFO] Reloading plugin container for: org.apache.maven.plugins:maven-assembly-plugin. The plugin artifact has changed.
[INFO] Reloading plugin container for: org.apache.maven.plugins:maven-clean-plugin. The plugin artifact has changed.
[INFO] Reloading plugin container for: org.apache.maven.plugins:maven-release-plugin. The plugin artifact has changed.
[INFO] Reloading plugin container for: org.apache.maven.plugins:maven-javadoc-plugin. The plugin artifact has changed.
[INFO] Reloading plugin container for: org.apache.maven.plugins:maven-site-plugin. The plugin artifact has changed.
[INFO] Reloading plugin container for: org.apache.maven.plugins:maven-install-plugin. The plugin artifact has changed.
[INFO] [site:attach-descriptor]
[INFO] [install:install]
[INFO] Installing D:\RSM\mobile\fd-mobile-android\pom.xml to C:\Users\hkhwileh.m2\repository\com\firstderivatives\rsm\mobile\android\fd-mobile-androi
d-parent\5.4-SNAPSHOT\fd-mobile-android-parent-5.4-SNAPSHOT.pom
[INFO] ------------------------------------------------------------------------

[ERROR] Cannot create the APKBuilder object

com.android.sdklib.build.ApkCreationException: java.io.FileNotFoundException: D:\RSM\mobile\fd-mobile-android\application\target\classes.dex does not
exist
at com.android.sdklib.build.ApkBuilder.init(ApkBuilder.java:455)
at com.android.sdklib.build.ApkBuilder.(ApkBuilder.java:386)
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:39)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:27)
at java.lang.reflect.Constructor.newInstance(Constructor.java:513)
at com.jayway.maven.plugins.android.phase09package.ApkBuilder.(ApkBuilder.java:197)
at com.jayway.maven.plugins.android.phase09package.ApkMojo.doAPKWithAPKBuilder(ApkMojo.java:206)
at com.jayway.maven.plugins.android.phase09package.ApkMojo.createApkFile(ApkMojo.java:171)
at com.jayway.maven.plugins.android.phase09package.ApkMojo.execute(ApkMojo.java:144)
at org.apache.maven.plugin.DefaultPluginManager.executeMojo(DefaultPluginManager.java:451)
at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoals(DefaultLifecycleExecutor.java:558)
at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoalWithLifecycle(DefaultLifecycleExecutor.java:499)
at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoal(DefaultLifecycleExecutor.java:478)
at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoalAndHandleFailures(DefaultLifecycleExecutor.java:330)
at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeTaskSegments(DefaultLifecycleExecutor.java:291)
at org.apache.maven.lifecycle.DefaultLifecycleExecutor.execute(DefaultLifecycleExecutor.java:142)
at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:336)
at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:129)
at org.apache.maven.cli.MavenCli.main(MavenCli.java:287)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at org.codehaus.classworlds.Launcher.launchEnhanced(Launcher.java:315)
at org.codehaus.classworlds.Launcher.launch(Launcher.java:255)
at org.codehaus.classworlds.Launcher.mainWithExitCode(Launcher.java:430)
at org.codehaus.classworlds.Launcher.main(Launcher.java:375)
Caused by: java.io.FileNotFoundException: D:\RSM\mobile\fd-mobile-android\application\target\classes.dex does not exist
at com.android.sdklib.build.ApkBuilder.checkInputFile(ApkBuilder.java:828)
at com.android.sdklib.build.ApkBuilder.init(ApkBuilder.java:432)
... 27 more

and the tail
so any one can help me

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

撩发小公举 2024-12-09 21:11:57

我猜您正在使用 ma​​ven-android-plugin 来构建您的应用程序。
问题是,在调用 android:apk 目标之前,您必须将类打包到 dex 文件。
要将类转换为 dex 格式,您需要使用 android:dex 目标,您还需要生成一些其他文件。

我用来构建 Android 应用程序的整个命令是:
<代码>
mvn clean 编译 android:generate-sources android:dex android:apk

I' guessing you are using maven-android-plugin to build your application.
The problem is that you have to pack your classes to dex file before invoking android:apk goal.
To convert classes to dex format you need to use android:dex goal you also need to generate some other files.

The whole command I use to build Android applications is:

mvn clean compile android:generate-sources android:dex android:apk

渡你暖光 2024-12-09 21:11:57

提供有关您的项目的更多详细信息,并可能提交错误。还可以尝试使用最新的 3.0.0-alpha 版本。

更新:现阶段最新版本是 3.5.0,通常如果您保持 Android SDK 为最新(并且您应该),您还应该遵循以下版本: Android Maven 插件。

Provide more details about your project and maybe file a bug. Also try it with the latest 3.0.0-alpha release..

Update: at this stage the latest release is 3.5.0 and generally if you keep your Android SDK up to date (and you should), you should also follow the release of the Android Maven Plugin.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文