Android的Maven插件 - 如何在部署后自动启动一个应用程序
问题描述:
我想知道如果有一种方法来启动这是使用部署在应用 MVN安装Android。如果这是某种程度上可能会加速比发展。
I wondering if there's a way to start an application which was deployed using mvn install android:deploy
automatically. If this is somehow possible it would speedup development.
答
下面的帖子:http://www.hrupin.com/2011/06/21/how-to-run-android-application-then-you-use-maven-in-your-project
首先,你需要添加插件,在您的POM
First you need to add plugin in your POM
<plugin>
<artifactId>exec-maven-plugin</artifactId>
<groupId>org.codehaus.mojo</groupId>
<configuration>
<executable>${basedir}/scripts/run_app.sh</executable>
</configuration>
</plugin>
在$ {} BASEDIR添加脚本/脚本/目录与下一个内容:
add script in ${basedir}/scripts/ dir with next content:
adb shell am start -a android.intent.action.MAIN -n your.app.package/.YourMainActivity
命令来构建和运行应用程序
Command to build and run app
MVN清洁安装Android:部署; MVN EXEC:EXEC
mvn clean install android:deploy; mvn exec:exec