如何使用Maven在命令行中启动应用程序

ihr*_*pin 2 android maven-2

我想在执行后在命令行中运行Android应用程序 android:deploy maven goal

Maven是否有一些可以在安装后运行应用程序的命令?

ihr*_*pin 5

谢谢mschonaker我找到了Maven的完整解决方案

首先,您需要在POM中添加插件

<plugin>
    <artifactId>exec-maven-plugin</artifactId>
    <groupId>org.codehaus.mojo</groupId>
    <configuration>
            <executable>${basedir}/scripts/run_app.sh</executable>
    </configuration>
</plugin>
Run Code Online (Sandbox Code Playgroud)

${basedir}/scripts/dir中添加下一个内容的脚本:

adb shell am start -a android.intent.action.MAIN -n your.app.package/.YourMainActivity
Run Code Online (Sandbox Code Playgroud)

用于构建和运行app的命令

mvn clean install android:deploy; mvn exec:exec
Run Code Online (Sandbox Code Playgroud)