Currently, I have been successfully developing many android applications and testing it directly in my phone using USB cable.
Right now, as the project getting bigger. I need to integrate our apps using Maven. I use Intellij version 12.1.4 as IDE.
Having look at various sources from google:
https://code.google.com/p/maven-android-plugin/wiki/GettingStarted
http://4thline.org/articles/Building%20Android%20applications%20with%20Maven%20and%20IntelliJ.html
As I successful compile and make a .apk file using 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>co.company</groupId>
<artifactId>XXX</artifactId>
<version>1.0</version>
<packaging>apk</packaging>
<name>Bisnis Pejantan</name>
<dependencies>
<dependency>
<groupId>com.google.android</groupId>
<artifactId>android</artifactId>
<version>4.1.1.4</version>
<scope>provided</scope>
</dependency>
</dependencies>
<build>
<finalName>${project.artifactId}</finalName>
<plugins>
<plugin>
<groupId>com.jayway.maven.plugins.android.generation2</groupId>
<artifactId>android-maven-plugin</artifactId>
<version>3.6.1</version>
<configuration>
<sdk>
<path>${env.ANDROID_HOME}</path>
<platform>14</platform>
</sdk>
<undeployBeforeDeploy>true</undeployBeforeDeploy>
</configuration>
<extensions>true</extensions>
</plugin>
</plugins>
</build>
</project>
My next objective is, to be able to install .apk file into my phone. However, when I execute deploy command in Intellij UI.
I got error:
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-deploy-plugin:2.7:deploy (default-deploy) on project XXX: Deployment failed: repository element was not specified in the POM inside distributionManagement element or in -DaltDeploymentRepository=id::layout::url parameter -> [Help 1]
org.apache.maven.lifecycle.LifecycleExecutionException: Failed to execute goal org.apache.maven.plugins:maven-deploy-plugin:2.7:deploy (default-deploy) on project XXX: Deployment failed: repository element was not specified in the POM inside distributionManagement element or in -DaltDeploymentRepository=id::layout::url parameter
As I swim to stackoverflow, I found these possible solutions below but, i didn't find any clear and neat solution/answer for my problem.
mvn android:deploy not working (despite success confirmation)
https://github.com/mosabua/maven-android-sdk-deployer
My questions:
How to make Maven DEPLOY works smoothly installing automatically my andorid app and executing the app on my Intellij just like the run command? What does it differ with Install command?
Why does my pom.xml ask for distributionManagement element?
Settings:
Windows 7 x64
Intellij version 12.1.4
Android SDK API level 18, 16.
Testing phone: Samsung Galaxy Note 2, android level 16.
Maven version 3.0.5
Android maven version 3.6.1