I prepared the following pom.xml to enable Maven builds for the opensource project MapChange:
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0
http://maven.apache.org/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
<artifactId>mapchange</artifactId>
<groupId>com.bricolsoftconsulting</groupId>
<version>0.1.0-SNAPSHOT</version>
<packaging>apklib</packaging>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<!-- Plugins -->
<jdk.version>1.6</jdk.version>
<api.platform>7</api.platform>
<android-maven-plugin.version>3.6.0</android-maven-plugin.version>
<maven-compiler-plugin.version>2.3.2</maven-compiler-plugin.version>
<!-- Dependencies -->
<android.version>4.1.1.4</android.version>
</properties>
<dependencies>
<dependency>
<groupId>com.google.android</groupId>
<artifactId>android</artifactId>
<scope>provided</scope>
<version>${android.version}</version>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>com.jayway.maven.plugins.android.generation2</groupId>
<artifactId>android-maven-plugin</artifactId>
<version>${android-maven-plugin.version}</version>
<extensions>true</extensions>
<configuration>
<sdk>
<platform>${api.platform}</platform>
</sdk>
<undeployBeforeDeploy>true</undeployBeforeDeploy>
<lazyLibraryUnpack>true</lazyLibraryUnpack>
</configuration>
</plugin>
<plugin>
<artifactId>maven-compiler-plugin</artifactId>
<version>${maven-compiler-plugin.version}</version>
<configuration>
<source>${jdk.version}</source>
<target>${jdk.version}</target>
</configuration>
</plugin>
</plugins>
</build>
</project>
When I run mvn clean install
the build finishes successfully.
But when I deploy and run the app to a device using mvn clean install android:deploy android:run
the activity cannot be found.
[ERROR] Failed to execute goal com.jayway.maven.plugins.android.generation2: \
android-maven-plugin:3.6.0:run (default-cli) on project mapchange: \
Unable to run launcher Activity: Starting: \
Intent { cmp=com.bricolsoftconsulting.mapchange/.MyMapActivity }
[ERROR] Error type 3
[ERROR] Error: Activity class \
{com.bricolsoftconsulting.mapchange/com.bricolsoftconsulting \
.mapchange.MyMapActivity} does not exist.
[ERROR] -> [Help 1]
[ERROR]
[ERROR] To see the full stack trace of the errors, re-run Maven \
with the -e switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR]
[ERROR] For more information about the errors and possible solutions, \
please read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/ \
MAVEN/MojoFailureException
Please notice that I am new to using Maven and the pom.xml might contain misconfigurations.