• Stars
    star
    441
  • Rank 98,861 (Top 2 %)
  • Language
    Java
  • License
    Apache License 2.0
  • Created almost 14 years ago
  • Updated about 4 years ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

Maven Archetypes for Android development

android-archetypes

This projects provides several Maven archetypes for Android. Those archetypes allows to quickly bootstrap a Maven project to develop an android application.

These artifacts are based on the android-maven-plugin (http://code.google.com/p/maven-android-plugin/). It currently uses the 3.8.2 version.

The android-quickstart archetype

The quickstart archetype creates a simple android application ready to be deployed on an android device. It's a pretty simple way to initiate an android project:

mvn archetype:generate \
  -DarchetypeArtifactId=android-quickstart \
  -DarchetypeGroupId=de.akquinet.android.archetypes \
  -DarchetypeVersion=1.0.11 \
  -DgroupId=your.company \
  -DartifactId=my-android-application

You can also set three optional properties :

  • The created 'package' with -Dpackage=your.company.android. By default it uses the given groupId.
  • The Android emulator's name to use with -Demulator=my-avd. If none specified the property will be ignored in the pom file.
  • The targeted Android platform with -Dplatform=X. The Android SDK version will be automatically fetched to fit the corresponding API level. Available API Level are 3, 4, 7, 8, 9, 10, 14 and 16. By default, it uses 16 (android 4.1.1.4).

Once generated, the application is ready to be built and deployed (you may need to configure your ANDROID_HOMEenvironment variable to point to your Android SDK). Start an android emulator, or plug an Android dev phone, and launch:

cd my-android-application
mvn clean install android:deploy android:run

The application will be built, deployed and launched on the device.

The android-with-test archetype

This archetype creates a multi-module project containing an android application and a project testing this application (integration tests using instrumentation).

mvn archetype:generate \
  -DarchetypeArtifactId=android-with-test \
  -DarchetypeGroupId=de.akquinet.android.archetypes \
  -DarchetypeVersion=1.0.11 \
  -DgroupId=com.foo.bar \
  -DartifactId=my-android-project \
  -Dpackage=com.foo.bar.android

You can also set three optional properties :

  • The created 'package' with -Dpackage=your.company.android. By default it uses the given groupId.
  • The Android emulator's name to use with -Demulator=my-avd. If none specified the property will be ignored in the pom file.
  • The targeted Android platform with -Dplatform=X. The Android SDK version will be automatically fetched to fit the corresponding API level. Available API Level are 3, 4, 7, 8, 9, 10, 14 and 16. By default, it uses 16 (android 4.1.1.4).

Once generated, the application is ready to be built and tested. Start an android emulator, or plug an Android dev phone, and launch:

cd my-android-project
mvn clean install

The application will be built, then the integration-tests will be built and executed on the Android device. If you whish to launch just the application:

cd my-android-project
mvn clean install android:deploy android:run

The android-library-quickstart archetype

The library quickstart archetype creates a simple Android library ready to be used with another Android application. It's a pretty simple way to initiate an android project:

mvn archetype:generate \
  -DarchetypeArtifactId=android-library-quickstart \
  -DarchetypeGroupId=de.akquinet.android.archetypes \
  -DarchetypeVersion=1.0.11 \
  -DgroupId=your.company \
  -DartifactId=my-android-application

You can also set three optional properties :

  • The created 'package' with -Dpackage=your.company.android. By default it uses the given groupId.
  • The targeted Android platform with -Dplatform=7. The Android SDK version will be automatically fetched to fit the corresponding API level. Available API Level are 3, 4, 7, 8, 9, 10 and 14. By default, it uses 10 (android 2.3.3).

Once generated, the library is ready to be built:

cd my-android-application
mvn clean install

The android-release archetype

This archetype extends android-with-test with release management.

mvn archetype:generate \
  -DarchetypeArtifactId=android-release \
  -DarchetypeGroupId=de.akquinet.android.archetypes \
  -DarchetypeVersion=1.0.11 \
  -DgroupId=com.foo.bar \
  -DartifactId=my-android-project \
  -Dpackage=com.foo.bar.android

You can also set three optional properties :

  • The created 'package' with -Dpackage=your.company.android. By default it uses the given groupId.
  • The Android emulator's name to use with -Demulator=my-avd. If none specified the property will be ignored in the pom file.
  • The targeted Android platform with -Dplatform=X. The Android SDK version will be automatically fetched to fit the corresponding API level. Available API Level are 3, 4, 7, 8, 9, 10, 14 and 16. By default, it uses 16 (android 4.1.1.4).

Once generated, the application is ready to be built and tested. Start an Android emulator, or plug an Android dev phone, and launch:

cd my-android-project
mvn clean install

The application will be built, then the integration-tests will be built and executed on the Android device.

If you whish to launch just the application:

cd my-android-project
mvn clean install android:deploy android:run

By default the app is built in "debug mode". This means BuildCongif.DEBUG is true and android:debuggable="true" and the apk is signed with the debug key (~/.android/debug.keystore).

When you release your application, it will generate a signed, zipaligned and ProGuard-processed apk. You will have to add a profile to your ~/.m2/settings.xml file containing the signing informations:

<profile>
  <id>android-release</id>
  <properties>
    <sign.keystore>/path/to/keystore</sign.keystore>
    <sign.alias>key alias</sign.alias>
    <sign.storepass>keystore password</sign.storepass>
    <sign.keypass>key password</sign.keypass>
  </properties>
</profile>

At this point you can generate a signed apk using the Maven release plugin:

mvn release:prepare
mvn release:perform -DreleaseProfiles=android-release,release
mvn release:clean

Or, if you wish to generate a signed apk without performing the whole release process:

mvn clean deploy -Pandroid-release,release

Be aware that Android cannot re-deploy artifacts using a different key, so be sure to undeploy all artifacts before running the release.

The android-gcm-quickstart archetype

The android-gcm-quickstart creates a simple Google Cloud Messaging application.

mvn archetype:generate \
  -DarchetypeArtifactId=android-gcm-quickstart \
  -DarchetypeGroupId=de.akquinet.android.archetypes \
  -DarchetypeVersion=1.0.11 \
  -DgroupId=your.company \
  -DartifactId=my-android-application
  -DsenderId=my-sender-id

The 'senderId' value is found in the Google APIs console. You can also set one optional property :

  • The URL of your GCM server, with -DgcmReceiverUrl=http://my-gcm-server. By default it uses the local test server provided by the gcmutils-maven-plugin.

Generated files includes the assets/gcmutils.properties configuration file, containing GCM specific values. Once generated, the library is ready to be built with:

cd my-android-application
mvn clean install

Before starting the test server add the API Key configuration. This can be added in the user settings file, ~/.m2/settings.xml, by system property -DapiKey= or in the pom.xml (not recommended). When the key is added, you can start the GCM test server:

mvn gcmutils:run-server

optionally:

mvn gcmutils:run-server -DapiKey=my-api-key

By default the server is available at http://localhost:9595

The gcmutils-maven-plugin provides three additional configuration options:

  • apiKey - Must be included, but is not recommended to be added in pom.xml
  • port - The port number of the test server. Default: 9595
  • contextRoot - The context root of the test server. Default: "/"

Detailed information on the gcmutils-maven-plugin is available here. For more information on GCM and how to obtain the senderId and API Key, see GCM: Getting Started.

Setting the maven-android-plugin version

You can change the default maven-android-plugin version by specifying the 'android-plugin-version' parameter.

Credits

The android-archetype-project is an open source project licensed under the Apache License 2.0. It is founded by akquinet

Technical Notes

  • As the archetypes used the new archetype format, they don't work with the deprecated goal 'archetype:create'

More Repositories

1

jquery-toastmessage-plugin

A JQuery plugin to 'toast' messages
JavaScript
374
star
2

androlog

androlog is a customizable Log replacement for Android
Java
55
star
3

jbosscc-as7-examples

JBoss AS 7 Example Projects
Java
36
star
4

android-intent-flags-tool

A small tool to understand the concept of Android intents.
Java
25
star
5

vaadinator

Quickly generate your mobile (or desktop) web application with vaadin - get to know vaadin
Java
25
star
6

ResponsiveLime

JavaScript
23
star
7

needle

Effective Unit Testing for Java EE
Java
23
star
8

nexus_cleaner

shell scripts to clean your release repositories in your nexus
Shell
21
star
9

maven-site-tutorial

A tutorial about Maven Sites
20
star
10

angularjs-blog

An example application to demonstrate AngularJS
JavaScript
19
star
11

maven-latex-plugin

Java
16
star
12

javascript-archetypes

Maven Archetypes for JavaScript development
Java
16
star
13

vaangular

Provide stellar integration of AngularJS with Vaadin
Java
15
star
14

roboject

An Injection Framework for Android
Java
14
star
15

GuttenBase

Copying done right...
Java
10
star
16

android-marvin

Marvin is an integration test framework for Android
Java
9
star
17

powerdns-api-proxy

API proxy for powerdns implementing multiple tokens and fine access control.
Python
9
star
18

jbosscc-wildfly-examples

Wildlfy / Java EE 7 Examples
Java
8
star
19

GcRustVsJvm

A comparison of traditional garbage collection vs. the approach of Rust.
Rust
7
star
20

chameRIA

JavaScript
6
star
21

kotlin-spring-graphql

A Demo project using GraphQL with Kotlin, Spring-Boot and JPA
Kotlin
5
star
22

picketlink-idm

forked 1.1.5.CR01 to support multiple ldap stores for querying
Java
5
star
23

cdi-ejb-memoryleak

Little sample project to show how you can easily run into a memory leak with CDI 1.0 and how to fix that
Java
5
star
24

mobile-blog

AeroGear example application
Java
4
star
25

arquillian-javamagazin

Source Code for Arquillian article in JavaMagazin.
Java
4
star
26

javaEE6-javaspektrum

Java
4
star
27

jquery-waitingpopup-plugin

A JQuery Plugin to create waiting popup
JavaScript
4
star
28

jboss-as7-jbpm-module

JBoss AS7 JBPM5 Module
Java
4
star
29

dailyplanner-angularjs

Demo application for our iBook "Rich Web Apps with AngularJS and Java EE"
Java
3
star
30

osgi-deployment-admin

An implementation of the OSGi Deployment Admin specification, and some tools around it
Java
3
star
31

flux

Java
3
star
32

oxidized-exporter

Oxidized prometheus exporter to expose device backup metrics
Go
3
star
33

pdnsgrep

Search through PowerDNS records on the cli
Go
3
star
34

machine-learning-weka-tutorial

How to use the WEKA library ... an example
Java
2
star
35

camunda-examples

Java
2
star
36

JavascriptPlusForVaadin

Provide stellar integration of JavaScript with Vaadin
Java
2
star
37

jpapitfalls

Java
1
star
38

jdbc-monitoring-micrometer

Measure JDBC calls wit MicroMeter
Kotlin
1
star
39

NoMoreIfs

Some simple examples for functional programming with optional values in Java
Java
1
star
40

jbosseap7-examples

CSS
1
star
41

stomp-client

A basic Stomp 1.1 implementation
1
star
42

sodium-ts-angular-calculator

TypeScript
1
star
43

vaadin-cdi-mvp

Java
1
star