5

I want a simple android hello world program in with maven.here is my pom.xml file

<?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.example.androidmaven</groupId>
<artifactId>gs-maven-android</artifactId>
<version>0.1.0</version>
<packaging>apk</packaging>

<dependencies>
    <dependency>
        <groupId>com.google.android</groupId>
        <artifactId>android</artifactId>
        <version>4.1.1.4</version>
        <scope>provided</scope>
    </dependency>
</dependencies>

<build>
    <plugins>
        <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>
                <deleteConflictingFiles>true</deleteConflictingFiles>
                <undeployBeforeDeploy>true</undeployBeforeDeploy>
            </configuration>
            <extensions>true</extensions>
        </plugin>
        <plugin>
            <artifactId>maven-compiler-plugin</artifactId>
            <version>3.1</version>
            <configuration>
                <source>1.6</source>
                <target>1.6</target>
            </configuration>
        </plugin>
    </plugins>
</build>

getting this error

[ERROR] Failed to execute goal com.jayway.maven.plugins.android.generation2:andr
oid-maven-plugin:3.8.2:generate-sources (default-generate-sources) on project gs
-maven-android: Execution default-generate-sources of goal com.jayway.maven.plug
ins.android.generation2:android-maven-plugin:3.8.2:generate-sources failed: Erro
r reading D:\adt-bundle-windows-x86-20130522\sdk\tools\tools\source.properties -
> [Help 1]
[ERROR]
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e swit
ch.
[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 rea
d the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/PluginExecutio
nException
peter
  • 1,028
  • 9
  • 21

3 Answers3

0

I am also getting the same error while running from jenkins. Please refer below

[ERROR] Failed to execute goal com.jayway.maven.plugins.android.generation2:android-maven-plugin:3.8.2:generate-sources (default-generate-sources) on project helloflashlight: Execution default-generate-sources of goal com.jayway.maven.plugins.android.generation2:android-maven-plugin:3.8.2:generate-sources failed: Error reading /home/iosmia/tools/android-sdk-linux/tools/source.properties -> [Help 1]

Note: I am able to successfully run the following command using commandline

mvn install

Update:

I could realize the permission to read the file is seen as below:

iosmia@iosmia-linux:~/tools/android-sdk-linux/tools$ ls -l source.properties 
-rw-rw---- 1 iosmia iosmia 70 Mar 22 01:47 source.properties

This means, jenkins is 'other' user so, it was not able to read the file. After giving read permission to all like below, I am able to build successfully.

iosmia@iosmia-linux:~/tools/android-sdk-linux/tools$ chmod 777 source.properties 
iosmia@iosmia-linux:~/tools/android-sdk-linux/tools$ ls -l source.properties 
-rwxrwxrwx 1 iosmia iosmia 70 Mar 22 01:47 source.properties
0

I have faced the same issue and is resolved by installing Swig. I was using MAC and here are the steps to install Swig.

ruby -e "$(curl -fsSL https://raw.github.com/Homebrew/homebrew/go/install)"

Install swig by running brew install swig then run

mvn install

It solved my issue and hoping it solves yours.

Jones
  • 1,480
  • 19
  • 34
Imam
  • 1
-3

Although I don't know what's the issue exactly, but from the log I found it's strange that the plugin reading source.properties from D:\adt-bundle-windows-x86-20130522\sdk\tools\tools\source.properties. I think the right path should be ...\sdk\tools\source.properties.

You can try the following places and see if something is wrong:

1.Eclipse: Windows | Preferences | Android | SDK Location

2.Windows Environment variable for ANDROID_HOME

maoruilin
  • 439
  • 4
  • 4