How to start application in command line with Maven

夙愿已清 提交于 2019-12-19 10:42:50

问题


I want to run Android application in command line after execution android:deploy maven goal

Does Maven have some command which can run application after install ?


回答1:


Thanks mschonaker I found the complete solution for Maven

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>

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 clean install android:deploy; mvn exec:exec



回答2:


It doesn't look like: http://maven-android-plugin-m2site.googlecode.com/svn/plugin-info.html

You can do it with adb instead. But you have to know the Activity name.

adb shell am start -a android.intent.action.MAIN -n your.app.package/.YourMainActivity



回答3:


Just an update. As of version 3.0.0 the android maven plugin has a run goal so you can start a deployed app on all attached devices with

mvn android:run

It will automatically parse the AndroidManifest and determine which activity to start. To work you have to run the command from within a apk project.



来源:https://stackoverflow.com/questions/6360103/how-to-start-application-in-command-line-with-maven

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!