This Archetype creates an Android project that can be built with Maven, Eclipse, Gradle, or Android Studio.
Why another Maven Android archetype? There may be better ones out there… I just wanted one I could keep up-to-date and that I could tailor to make projects that work on all of Eclipse, Maven, Gradle and Android Studio.
First, until I get this onto Maven Central, just grab the source project and do mvn install
.
Just run mvn archetype:generate
as usual. Here’s an example.
mvn archetype:generate \ -DarchetypeGroupId=com.darwinsys \ -DarchetypeArtifactId=mvn-archetype-android \ -DarchetypeVersion=1.0.0-SNAPSHOT \ -DgroupId=com.example123 \ -DartifactId=android123 \ -Dversion=1.0.0-SNAPSHOT \ -DinteractiveMode=false
This can be run using scripts/basic.sh
under *Nix, but you’ll want to change the groupId and artifactId
before running.
The file scripts/androidproject
uses the shell builtin getopts to parse arguments
and can be run as follows:
scripts/androidproject [-g groupId][-p packageName][-d parentDirectory] artfactName
e.g.,
scripts/androidproject -d /tmp -g com.example demoproject54
For Maven or Eclipse, you must have extracted the Android SDK into Maven format using the maven-android-installer.
For Eclipse, as above, plus, you must have AndMore and M2E in your install (get it from Help→Eclipse Market Client).
For Gradle or Android Studio, it may "just work", though it will demand to upgrade the project if you’ve been using your Studio installation for more than 2.5 hours.