How to run Android application then you use Maven in your project
Then i first tried use Maven in my Android projects i have some discomfort then run my applications with
mvn clean install android:deploy
and then all is successful i can see my app bringing to front of my device which i can see then run standard Android apps with Run As..–>Android Aplication in Eclipse.
This instruction will works only in Linux. If you use Windows you need to rewrite some scripts according to your OS shell script language
I find some solution of this little problem.
First you need Exec Maven Plugin existing in your pom.xml
<plugin>
<artifactId>exec-maven-plugin</artifactId>
<groupId>org.codehaus.mojo</groupId>
<configuration>
<executable>${basedir}/scripts/run_app.sh</executable>
</configuration>
</plugin>
Next create scripts dir in your project. That dir need to heve run_app.sh bash file with next content:
adb shell am start -a android.intent.action.MAIN -n your.app.package/.YourMainActivity
Go to scripts dir in your terminal and make this file executable by all with
sudo chmod '777' run_app.sh
That all. Next you need to execute next in your terminal then located in project root dir (same level as pom.xml)
mvn clean install android:deploy; mvn exec:exec
Hope it will useful for you
Project you can download below.
Just untar and import as Existing Maven Project in your Eclipse.
1 Comment
mobile applications · 13 June, 2012 at 10:17
Nice information, many thanks to the author. It is incomprehensible to me currently, but in general, the usefulness and significance is overwhelming. Thanks again and fine luck!