androideclipsemavenandroid-maven-plugin

maven android error reading file source.properties


I am trying to build a simple hello world android app. I am getting this error:

Failed to execute goal com.jayway.maven.plugins.android.generation2:android-maven- 
plugin:3.9.0-rc.2:generate-sources (default-generate-sources) on project ndbc: 
Execution default-generate-sources of goal 
com.jayway.maven.plugins.android.generation2:android-maven-plugin:3.9.0-rc.2:generate-
sources failed: Error reading /storage/code/android-NDBC/ndbc/~/android-sdks/tools
/source.properties -> [Help 1]

I am using maven 3.2.1

here is my POM:

<dependencies>
    <dependency>
        <groupId>com.google.android</groupId>
        <artifactId>android</artifactId>
        <version>4.1.1.4</version>
        <scope>provided</scope>
    </dependency>
</dependencies>
<build>
    <finalName>ndbc</finalName>
    <pluginManagement>
        <plugins>
            <plugin>
                <groupId>com.jayway.maven.plugins.android.generation2</groupId>
                <artifactId>android-maven-plugin</artifactId>
                <version>3.9.0-rc.2</version>
                <extensions>true</extensions>
            </plugin>
        </plugins>
    </pluginManagement>
    <plugins>
        <plugin>
            <groupId>com.jayway.maven.plugins.android.generation2</groupId>
            <artifactId>android-maven-plugin</artifactId>

            <configuration>
                <sdk>
                    <platform>19</platform>
                </sdk>
                                </configuration>
        </plugin>
    </plugins>
</build>

I believe that I have all my environment vars set correctly:

export ANDROID_SDK_HOME=/home/michel/android-sdks
export ANDROID_HOME=/home/michel/android-sdks
export PATH="$PATH:~/android-sdks/tools"
export PATH="$PATH:~/android-sdks/platform-tools"

when I run mvn install OR mvn android:apk I get the same error.

What is weird is that when I run this in eclipse I get the same error, but if I run it through the AVM it works fine, just actually BUILDING the apk that seems to be the problem.

Any ideas?


Solution

  • Sasikumar M had the correct path.. (pun intended)

    The android-maven-plugin is not picking up the ANDROID_HOME for some reason. Setting it in the properties did not work, but setting it in the plugin did. Set the path in the configuration. Here is POM fragment.

                <plugin>
                <groupId>com.jayway.maven.plugins.android.generation2</groupId>
                <artifactId>android-maven-plugin</artifactId>
                <configuration>
                    <sdk>
                        <path>/home/michel/android-sdks</path>
                        <platform>19</platform>
                    </sdk>
                </configuration>
            </plugin>