调用" Maven项目生成器"在Eclipse中的运行方式 - > Android应用程序(或手动)生成器、应用程序、方式、项目

2023-09-05 08:20:38 作者:℡ 肾虚道长%

我正在使用Maven的Andr​​oid项目的构建工具,和被玩弄的Eclipse,Android的ADT,m2eclipse的,Maven的Andr​​oid插件,Maven的集成为Android开发工具的配置,以及Subclipse的,而现在,但不能得到它的工作可以接受的。也就是说,无论是建造时间过长或项目未重建,部署在模拟器上理所应当的。

I'm working on an Android project with Maven as build tool, and been playing around with the configuration of Eclipse, Android ADT, m2eclipse, Maven Android Plugin, Maven Integration for Android Development Tools, and Subclipse for a while now, but can't get it to work acceptable. That is, either the build time is unnecessarily long or the project is not rebuilt and deployed on the emulator as it should be.

目前,我已经做了大致与下面描述的结果如下:

At the moment, I have done approximately the following with the result described below:

在安装了Eclipse的伽利略(3.5.2)从Ubuntu 11.04的默认存储库。 在安装了Eclipse插件的上方和Android SDK中提到的。 通过导入该项目的检查出Maven项目从SCM 的 禁用所有建设者的项目,除了 Maven项目生成器的 确信的自动构建的检查。 Installed Eclipse Galileo (3.5.2) from the default repositories of Ubuntu 11.04. Installed the Eclipse plugins mentioned above and the Android SDK. Imported the project through Check out Maven Projects from SCM. Disabled all Builders for the project, except Maven Project Builder. Made sure Build Automatically is checked.

Maven项目生成器的调用并运行:

aapt [package, -m, -J, .../application/target/generated-sources/r, -M, .../application/AndroidManifest.xml, -S, .../application/target/generated-sources/combined-resources/res, -A, .../application/assets, -I, .../android-7/android.jar]

dx [--dex, --output=.../application/target/classes.dex, .../application/target/android-classes]

aapt [package, -f, -M, .../application/AndroidManifest.xml, -S, .../application/target/generated-sources/combined-resources/res, -A, .../application/target/generated-sources/combined-assets/assets, -I, .../android-7/android.jar, -F, .../target/xxx-android-project-1.0-SNAPSHOT.ap_]

拍摄时间:〜15秒,其间:

Time taken: ~15 seconds, during which:

的Eclipse被阻止用于随后用户的操作,如保存。 在一个CPU核心繁忙,系统变得缓慢。

应用程序安装和〜10秒内正常启动。

The application is installed and launched correctly within ~10 seconds.

输出在控制台(安卓):

Output in Console (Android):

Android Launch!
adb is running normally.
Performing com.xxx.android.activity.LoginActivity activity launch
Automatic Target Mode: Preferred AVD 'xxx_test_device' is available on emulator 'emulator-5554'
Uploading xxx-android-project.apk onto device 'emulator-5554'
Installing xxx-android-project.apk...
Success!
Starting activity com.xxx.android.activity.LoginActivity on device emulator-5554
ActivityManager: Starting: Intent { act=android.intent.action.MAIN cat=[android.intent.category.LAUNCHER] cmp=com.xxx.android/.activity.LoginActivity }

我想发生

在文件保存

只有被保存应该被编译并放置到配置的输出文件夹中的文件,瞬间快速。

What I would like to happen

On file save

Only the file being saved should be compiled and placed into the configured output folder, instantly quick.

的的Maven项目生成器的调用,它执行冗长的 AAPT 和 DX 的过程,目前对每个文件进行被保存。 在应用程序安装,并在模拟器上推出。 Maven Project Builder is invoked, which performs the lengthy aapt and dx process, which is currently performed on every file save. The application is installed and launched on the emulator. 如何实现上面所描述? 有没有可能让Maven项目生成器之前运行方式只运行 - > Android应用程序,但不是每一个文件保存?怎么样?

我试图禁用的自动构建的,使所有的建设者,然后运行的项目的 - >的生成项目的关于该项目的问题,但然后什么也没有发生,当我做的运行方式的 - 。>的 Android应用程序的的code的变化并不present

I have tried to disable Build Automatically, enable all Builders and then run Project -> Build Project on the project in question, but then nothing happens and when I do Run As -> Android Application the code changes are not present.

我试图禁用的的Maven项目生成器的,使所有其他建设者,使的自动构建的,但在保存文件后,我看到在控制台(安卓)

I have tried to disable the Maven Project Builder and enable all other Builders, enable Build Automatically, but after saving the file I see this in the Console (Android):

Refreshing resource folders.
Starting incremental Pre Compiler: Checking resource changes.
Nothing to pre compile!
Starting incremental Package build: Checking resource changes.
Starting full Post Compiler.
Refreshing resource folders.
Starting incremental Pre Compiler: Checking resource changes.
Nothing to pre compile!

和上的运行方式的 - >的 Android应用程序的这一错误的应用程序崩溃:

And on Run As -> Android Application the application crashes with this error:

java.lang.RuntimeException: Unable to instantiate application com.xxx.android.XXXApplication: java.lang.ClassNotFoundException: com.xxx.android.XXXApplication in loader dalvik.system.PathClassLoader@44bfe130

相关问题

Android的编译速度很慢(使用Eclipse)。

也解释了为什么在 DX 过程是如此漫长,并建议使用Ant在命令行手动,只有建立必要的时候。其实,我想这一点,但不能把它与Maven的依赖复制所有依赖JAR文件,甚至工作时,库/ 使用Maven插件。

Explains why the dx process is so lengthy and suggests using Ant from the command line to build manually and only when necessary. I actually tried this, but couldn't get it to work with the Maven dependencies, even when copying all dependency JARs to libs/ using a Maven plugin.

For在Eclipse中Maven项目,我可以配置菜单选项项目/洁净援引MVN干净吗?

解释如何通过Eclipse中清洗后的项目运行特定的目标,但我不希望在模拟器上,每次安装前清洁项目。

Explains how to run specific goals after cleaning the project through Eclipse, but I would not like to clean the project before every installation on the emulator.

我想Eclipse来运行的 AAPT 和 DX 进程会通过的的Maven项目生成器的,只有当我做的运行方式 - > Android应用程序的,保存文件,而不是在。应用程序应然后在模拟器启动。

I would like Eclipse to run the aapt and dx processes through Maven Project Builder only when I do Run As -> Android Application, and not when saving a file. The application should then be launched in the emulator.

推荐答案

迁移到摇篮和摇篮的IDE支持,如的IntelliJ或Android工作室。

Migrate to Gradle and an IDE with Gradle support such as IntelliJ or Android Studio.