Why does android:lint only scans my Aggregator Project for Lint warnings and skips the "APP" Module ?
In the POM of the APP Module i defined:
<plugins>
<plugin>
<groupId>com.jayway.maven.plugins.android.generation2</groupId>
<artifactId>android-maven-plugin</artifactId>
<extensions>true</extensions>
<executions>
<execution>
<id>lint</id>
<goals>
<goal>lint</goal>
</goals>
<phase>install</phase>
</execution>
</executions>
<configuration>
<sdk>
<platform>${android.platform}</platform>
</sdk>
<androidManifestFile>${project.basedir}/AndroidManifest.xml</androidManifestFile>
<assetsDirectory>${project.basedir}/assets</assetsDirectory>
<resourceDirectory>${project.basedir}/res</resourceDirectory>
<nativeLibrariesDirectory>${project.basedir}/src/main/native</nativeLibrariesDirectory>
<sign>
<debug>true</debug>
</sign>
<lint>
<skip>false</skip>
</lint>
<undeployBeforeDeploy>true</undeployBeforeDeploy>
<zipalign>
<skip>false</skip>
<verbose>true</verbose>
<inputApk>${project.build.directory}/${project.artifactId}.apk</inputApk>
<outputApk>${project.build.directory}/${project.artifactId}-aligned.apk</outputApk>
</zipalign>
</configuration>
</plugin>
Cheers
I do not think we have implemented it to work in a multi module build this way. However you can just configure the plugin in the aggregator and the execution in the apk project and it will work.
Related
My Android build works fine in Continuous Integration, except for androidSigning: Gradle can allow for a developer to catch the keystore path and passwords in clear. Which is not satisfactory.
1- Have you a workaround for that? Such as password encryption...
2- My idea is now to build with Gradle, and sign and zipalign with Maven.
Currently I succeed in signing an existing apk, but cannot zipalign the signed apk. Here is the pom.xml located in the app folder:
<profiles>
<profile>
<id>sign</id>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-jarsigner-plugin</artifactId>
<version>1.4</version>
<executions>
<execution>
<id>signing</id>
<goals>
<goal>sign</goal>
</goals>
... all parameters ok...
</execution>
</executions>
</plugin>
<plugin>
<groupId>com.jayway.maven.plugins.android.generation2</groupId>
<artifactId>android-maven-plugin</artifactId>
<version>3.8.2</version>
<inherited>true</inherited>
<configuration>
<sign>
<debug>false</debug>
</sign>
<zipalign>
<verbose>true</verbose>
<inputApk>${apk.build.directory}/app-release-unsigned.apk</inputApk>
<outputApk>${apk.build.directory}/app-release-signed-aligned.apk</outputApk>
<skip>false</skip>
</zipalign>
</configuration>
<executions>
<execution>
<id>alignApk</id>
<phase>package</phase>
<goals>
<goal>zipalign</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
</profile>
</profiles>
Results is
[INFO] --- maven-jarsigner-plugin:1.4:sign (signing) # mavensigning ---
[INFO] 1 archive(s) traitées
[INFO]
[INFO] --- android-maven-plugin:3.8.2:zipalign (alignApk) # mavensigning ---
[INFO] Skipping zipalign on pom
Any idea why I cannont perform zipalign?
I have an Android project which I ¨mavenized¨ (Configure > Convert to Maven Project) using the M2E - Maven Integration for Eclipse.
The project uses a google play services library, which was transformed into an apklib. I added this dependency to my project (to my pom.xml). I have to mention that the pom was build automatically, but I replaced it with the one generated by :
mvn help:effective-pom
After that I did a clean install and built the project with maven, having the following goals in run config:
clean install -Dandroid.sdk.path="path to my sdk" android:deploy android:run
Everything works fine, but I have errors in my project(so I can't run it as an Android app). It looks like everything related to the google library is not recognized.
My pom.xml looks like this:
<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/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>MyProject</groupId>
<artifactId>MyProject</artifactId>
<version>1.1-SNAPSHOT</version>
<name>MyProject</name>
<!-- <packaging>apk</packaging> --> <!-- if i try to add packaging it will give an error -->
<dependencies>
<dependency>
<groupId>com.google.air</groupId>
<artifactId>googleplayair</artifactId>
<version>1.1</version>
<type>apklib</type>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>com.crashlytics</groupId>
<artifactId>crashlytics</artifactId>
<version>1.0</version>
</dependency>
</dependencies>
<repositories>
<repository>
<snapshots>
<enabled>false</enabled>
</snapshots>
<id>central</id>
<name>Central Repository</name>
<url>http://repo.maven.apache.org/maven2</url>
</repository>
</repositories>
<pluginRepositories>
<pluginRepository>
<releases>
<updatePolicy>never</updatePolicy>
</releases>
<snapshots>
<enabled>false</enabled>
</snapshots>
<id>central</id>
<name>Central Repository</name>
<url>http://repo.maven.apache.org/maven2</url>
</pluginRepository>
</pluginRepositories>
<build>
<sourceDirectory>/User/Documents/eclipse/cruzcampo-android/app/cruzcampo/src/main/java</sourceDirectory>
<scriptSourceDirectory>/User/Documents/eclipse/MyProject/src/main/scripts</scriptSourceDirectory>
<testSourceDirectory>/User/Documents/eclipse/MyProject/src/test/java</testSourceDirectory>
<outputDirectory>/User/Documents/eclipse/MyProject/target/classes</outputDirectory>
<testOutputDirectory>/User/Documents/eclipse/MyProject/target/test-classes</testOutputDirectory>
<resources>
<resource>
<directory>/User/Documents/eclipse/MyProject/src/main/resources</directory>
</resource>
</resources>
<testResources>
<testResource>
<directory>/User/Documents/eclipse/MyProject/src/test/resources</directory>
</testResource>
</testResources>
<directory>/User/Documents/eclipse/MyProject/target</directory>
<finalName>MyProject-1.1-SNAPSHOT</finalName>
<pluginManagement>
<plugins>
<plugin>
<artifactId>maven-antrun-plugin</artifactId>
<version>1.3</version>
</plugin>
<plugin>
<artifactId>maven-assembly-plugin</artifactId>
<version>2.2-beta-5</version>
</plugin>
<plugin>
<artifactId>maven-dependency-plugin</artifactId>
<version>2.8</version>
</plugin>
<plugin>
<artifactId>maven-release-plugin</artifactId>
<version>2.3.2</version>
</plugin>
<!-- </plugins> -->
<!-- </pluginManagement> -->
<!-- <plugins> -->
<plugin>
<artifactId>maven-clean-plugin</artifactId>
<version>2.5</version>
<executions>
<execution>
<id>default-clean</id>
<phase>clean</phase>
<goals>
<goal>clean</goal>
</goals>
</execution>
</executions>
</plugin>
<plugin>
<artifactId>maven-install-plugin</artifactId>
<version>2.4</version>
<executions>
<execution>
<id>default-install</id>
<phase>install</phase>
<goals>
<goal>install</goal>
</goals>
</execution>
</executions>
</plugin>
<plugin>
<artifactId>maven-resources-plugin</artifactId>
<version>2.6</version>
<executions>
<execution>
<id>default-resources</id>
<phase>process-resources</phase>
<goals>
<goal>resources</goal>
</goals>
</execution>
<execution>
<id>default-testResources</id>
<phase>process-test-resources</phase>
<goals>
<goal>testResources</goal>
</goals>
</execution>
</executions>
</plugin>
<plugin>
<artifactId>maven-surefire-plugin</artifactId>
<version>2.12.4</version>
<executions>
<execution>
<id>default-test</id>
<phase>test</phase>
<goals>
<goal>test</goal>
</goals>
</execution>
</executions>
</plugin>
<plugin>
<artifactId>maven-compiler-plugin</artifactId>
<version>2.5.1</version>
<executions>
<execution>
<id>default-testCompile</id>
<phase>test-compile</phase>
<goals>
<goal>testCompile</goal>
</goals>
</execution>
<execution>
<id>default-compile</id>
<phase>compile</phase>
<goals>
<goal>compile</goal>
</goals>
</execution>
</executions>
</plugin>
<plugin>
<artifactId>maven-jar-plugin</artifactId>
<version>2.4</version>
<executions>
<execution>
<id>default-jar</id>
<phase>package</phase>
<goals>
<goal>jar</goal>
</goals>
</execution>
</executions>
</plugin>
<plugin>
<artifactId>maven-deploy-plugin</artifactId>
<version>2.7</version>
<executions>
<execution>
<id>default-deploy</id>
<phase>deploy</phase>
<goals>
<goal>deploy</goal>
</goals>
</execution>
</executions>
</plugin>
<plugin>
<artifactId>maven-site-plugin</artifactId>
<version>3.3</version>
<executions>
<execution>
<id>default-site</id>
<phase>site</phase>
<goals>
<goal>site</goal>
</goals>
<configuration>
<outputDirectory>/User/Documents/eclipse/MyProject/target/site</outputDirectory>
<reportPlugins>
<reportPlugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-project-info-reports-plugin</artifactId>
</reportPlugin>
</reportPlugins>
</configuration>
</execution>
<execution>
<id>default-deploy</id>
<phase>site-deploy</phase>
<goals>
<goal>deploy</goal>
</goals>
<configuration>
<outputDirectory>/User/Documents/eclipse/MyProject/target/site</outputDirectory>
<reportPlugins>
<reportPlugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-project-info-reports-plugin</artifactId>
</reportPlugin>
</reportPlugins>
</configuration>
</execution>
</executions>
<configuration>
<outputDirectory>/User/Documents/eclipse/MyProject/target/site</outputDirectory>
<reportPlugins>
<reportPlugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-project-info-reports-plugin</artifactId>
</reportPlugin>
</reportPlugins>
</configuration>
</plugin>
<plugin>
<groupId>
com.jayway.maven.plugins.android.generation2
</groupId>
<artifactId>android-maven-plugin</artifactId>
<version>3.8.2</version>
<configuration>
<sdk>
<platform>19</platform>
</sdk>
</configuration>
<extensions>true</extensions>
</plugin>
</plugins>
</pluginManagement>
</build>
<reporting>
<outputDirectory>/User/Documents/eclipse/MyProject/target/site</outputDirectory>
</reporting>
I guess that right now Maven is working fine, but there is a problem with Android.
Any suggestions?
The Eclipse ADT does not support the Maven archive format for apklib dependencies. In order for this to successfully compile in Eclipse you need to have the full source of a "Mavenised" (i.e. contained a POM with matching Maven coordinates to the dependency declared in your app POM) Android Library project imported into your Eclipse workspace.
I am writing POM.xml file for Android app and I constantly get an error. It appears after I use Maven plugin in Eclipse (Project->properties->Configure->Convert to Maven). I put an error below the code.
<build>
<finalName>${project.artifactId}</finalName>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-resources-plugin</artifactId>
<executions>
<execution>
<!-- use the copy resources instead of resources, which adds it to
the eclipse buildpath -->
<phase>initialize</phase>
<goals>
<goal>copy-resources</goal>
</goals>
<configuration>
<outputDirectory>${project.basedir}/res</outputDirectory>
<resources>
<resource>
<directory>${project.basedir}/src/templates/res</directory>
<targetPath>${project.basedir}/res</targetPath>
<filtering>true</filtering>
</resource>
</resources>
</configuration>
</execution>
</executions>
</plugin>
<plugin> <!----- Error here ---------->
<groupId>com.jayway.maven.plugins.android.generation2</groupId>
<artifactId>android-maven-plugin</artifactId>
<extensions>true</extensions>
<configuration>
<manifest>
<debuggable>true</debuggable>
</manifest>
</configuration>
<executions>
<execution>
<id>manifestUpdate</id>
<phase>process-resources</phase>
<goals>
<goal>manifest-update</goal>
</goals>
</execution>
<execution>
<id>alignApk</id>
<phase>package</phase>
<goals>
<goal>zipalign</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
Error :
Multiple annotations found at this line:
- Plugin execution not covered by lifecycle configuration: com.jayway.maven.plugins.android.generation2:android-maven-plugin:3.6.1:proguard (execution: default-proguard, phase: process-classes)
- Plugin execution not covered by lifecycle configuration: com.jayway.maven.plugins.android.generation2:android-maven-plugin:3.6.1:generate-sources (execution: default-generate-sources, phase: generate-
sources)
wrap your <plugins> with <pluginManagement> like so:
<pluginManagement>
<plugins>
<plugin>
...
</plugin>
<plugin>
...
</plugin>
</plugins>
</pluginManagement>
for further reading: How to solve "Plugin execution not covered by lifecycle configuration" for Spring Data Maven Builds
Installing the Android Connector for Maven Eclipse should resolve this issue.
Hey I am having a hard time building and signing apk in release mode. I am able to create the apk using maven but when I try to upload it, Google playstore says that I need to build in release mode.
here is my pom.xml:
<?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>
<groupId>com.kannact4.gladstonesign</groupId>
<artifactId>gladstonesign</artifactId>
<version>1.0.0-SNAPSHOT</version>
<packaging>apk</packaging>
<name>Android Maven Example</name>
<profiles>
<profile>
<id>release</id>
<activation>
<property>
<name>performRelease</name>
<value>true</value>
</property>
</activation>
</profile>
</profiles>
<dependencies>
<dependency>
<groupId>com.google.android</groupId>
<artifactId>android</artifactId>
<version>2.2.1</version>
<scope>provided</scope>
</dependency>
</dependencies>
<build>
<finalName>unaligned-gladstonesign</finalName>
<sourceDirectory>src</sourceDirectory>
<pluginManagement>
<plugins>
<plugin>
<groupId>com.jayway.maven.plugins.android.generation2</groupId>
<artifactId>android-maven-plugin</artifactId>
<version>3.1.1</version>
<extensions>true</extensions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-jarsigner-plugin</artifactId>
<version>1.2</version>
<configuration>
<keystore>C:\Project\Eclipse workspace\apk_key</keystore>
<alias>gs3key</alias>
<storepass>****</storepass>
<keypass>****</keypass>
<verbose>true</verbose>
<certs>true</certs>
</configuration>
</plugin>
</plugins>
</pluginManagement>
<plugins>
<plugin>
<groupId>com.jayway.maven.plugins.android.generation2</groupId>
<artifactId>android-maven-plugin</artifactId>
<configuration>
<sdk>
<platform>17</platform>
</sdk>
</configuration>
</plugin>
</plugins>
</build>
</project>
Can anyone help me with how to release it in the build mode?
Your apk needs to be signed and zipaligned. So you should first 'bind' the jarsigner execution to the package phase and in an 2nd time configure zipalign in your android plugin. see http://www.simpligility.com/2010/07/sign-zipalign-and-to-market-to-market-with-maven/
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-jarsigner-plugin</artifactId>
<executions>
<execution>
<id>signing</id>
<goals>
<goal>sign</goal>
<goal>verify</goal>
</goals>
<phase>package</phase>
<inherited>true</inherited>
<configuration>
<removeExistingSignatures>true</removeExistingSignatures>
<archiveDirectory/>
<includes>
<include>${project.build.directory}/${project.artifactId}.apk</include>
</includes>
<keystore>${sign.keystore}</keystore>
<alias>${sign.alias}</alias>
<storepass>${sign.storepass}</storepass>
<keypass>${sign.keypass}</keypass>
<verbose>true</verbose>
</configuration>
</execution>
</executions>
</plugin>
<plugin>
<groupId>com.jayway.maven.plugins.android.generation2</groupId>
<artifactId>maven-android-plugin</artifactId>
<inherited>true</inherited>
<configuration>
<sign>
<debug>false</debug>
</sign>
<zipalign>
<verbose>true</verbose>
<inputApk>${project.build.directory}/${project.artifactId}.apk</inputApk>
<outputApk>${project.build.directory}/${project.artifactId}-signed-aligned.apk
</outputApk>
<skip>false</skip>
</zipalign>
</configuration>
<executions>
<execution>
<id>alignApk</id>
<phase>package</phase>
<goals>
<goal>zipalign</goal>
</goals>
</execution>
</executions>
</plugin>
We are working on size optimisation for my Android Application.
However after we have made significant reductions in the size of the resources folder, reduced it by 8mb, when i compile (using maven) the size of the app is only reduced by .1 mb.
Can someone explain why this is happening?
I am zipaligning but thats all in the pom.
here is the build segment of the pom
<build>
<plugins>
<plugin>
<groupId>com.jayway.maven.plugins.android.generation2</groupId>
<artifactId>android-maven-plugin</artifactId>
<version>3.2.0</version>
<extensions>true</extensions>
<configuration>
<!-- replace resources with target specific -->
<renameManifestPackage>${customerPackage}</renameManifestPackage>
<resourceOverlayDirectory>${customerResources}</resourceOverlayDirectory>
<sign>
<debug>false</debug>
</sign>
<manifest>
<versionCodeAutoIncrement>true</versionCodeAutoIncrement>
</manifest>
<zipalign>
<inputApk>${project.build.directory}/${project.build.finalName}.apk</inputApk>
<outputApk>${project.build.directory}/outputfile.apk</outputApk>
</zipalign>
<proguard>
<skip>true</skip>
</proguard>
<sdk>
<!-- platform or api level (api level 4 = platform 1.6)-->
<platform>17</platform>
</sdk>
<assetsDirectory>${project.basedir}/${customerAssets}</assetsDirectory>
<resourceDirectory>${project.basedir}/res</resourceDirectory>
</configuration>
<executions>
<execution>
<id>manifestUpdate</id>
<phase>process-resources</phase>
<goals>
<goal>manifest-update</goal>
</goals>
</execution>
<execution>
<id>alignApk</id>
<phase>package</phase>
<goals>
<goal>zipalign</goal>
</goals>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-jarsigner-plugin</artifactId>
<version>1.2</version>
<executions>
<execution>
<id>signing</id>
<goals>
<goal>sign</goal>
</goals>
<phase>package</phase>
<inherited>true</inherited>
<configuration>
<archiveDirectory></archiveDirectory>
<includes>
<include>target/*.apk</include>
</includes>
<keystore>../certificates/mycertificate.keystore</keystore>
<storepass>*******</storepass>
<keypass>******</keypass>
<alias>myalias</alias>
</configuration>
</execution>
</executions>
</plugin>
<!-- <plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-javadoc-plugin</artifactId>
<configuration>
<skip>true</skip>
</configuration>
</plugin> -->
</plugins>
</build>
Any help will be much appreciated.
An APK is already compressed. By compressing your resources individually, all your doing is leaving less to be done in the APK compression stage.
Think of it this way, create a large text file, compress it into a zip, and you'll see the zip is far smaller.
Now compress this zipped text file, into another zip file. Do you expect that to be any smaller? Nope, it'll barely change, larger if anything.
On a high level, it's basically the same as compressing your resources, then asking the APK to compress all of them again.