3

So I'm running into a compile error while using the android plugin for maven.

[DEBUG] ANDROID-040-000: Executed command: Commandline = /bin/sh -c cd /Users/adrian/Development/projects/GogoDroid && /Users/adrian/Development/bin/android-sdk-macosx/platform-tools/aapt package -f -M /Users/adrian/Development/projects/GogoDroid/AndroidManifest.xml -S /Users/adrian/Development/projects/GogoDroid/res -S /Users/adrian/Development/projects/GogoDroid/target/unpack/apklibs/org.holoeverywhere_library_apklib_1.4.0/res -S /Users/adrian/Development/projects/GogoDroid/target/unpack/apklibs/com.actionbarsherlock_actionbarsherlock_apklib_4.2.0/res -S /Users/adrian/Development/projects/GogoDroid/target/unpack/apklibs/com.facebook.android_Facebook_apklib_3.0.0/res --auto-add-overlay -A /Users/adrian/Development/projects/GogoDroid/target/generated-sources/combined-assets/assets -I /Users/adrian/Development/bin/android-sdk-macosx/platforms/android-16/android.jar -F /Users/adrian/Development/projects/GogoDroid/target/gogodroid.ap_, Result = 1
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 58.008s
[INFO] Finished at: Thu Dec 20 02:47:51 PST 2012
[INFO] Final Memory: 18M/123M
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal com.jayway.maven.plugins.android.generation2:android-maven-plugin:3.4.1:apk (default-apk) on project gogodroid: MojoExecutionException: ANDROID-040-001: Could not execute: Command = /bin/sh -c cd /Users/adrian/Development/projects/GogoDroid && /Users/adrian/Development/bin/android-sdk-macosx/platform-tools/aapt package -f -M /Users/adrian/Development/projects/GogoDroid/AndroidManifest.xml -S /Users/adrian/Development/projects/GogoDroid/res -S /Users/adrian/Development/projects/GogoDroid/target/unpack/apklibs/org.holoeverywhere_library_apklib_1.4.0/res -S /Users/adrian/Development/projects/GogoDroid/target/unpack/apklibs/com.actionbarsherlock_actionbarsherlock_apklib_4.2.0/res -S /Users/adrian/Development/projects/GogoDroid/target/unpack/apklibs/com.facebook.android_Facebook_apklib_3.0.0/res --auto-add-overlay -A /Users/adrian/Development/projects/GogoDroid/target/generated-sources/combined-assets/assets -I /Users/adrian/Development/bin/android-sdk-macosx/platforms/android-16/android.jar -F /Users/adrian/Development/projects/GogoDroid/target/gogodroid.ap_, Result = 1 -> [Help 1]
org.apache.maven.lifecycle.LifecycleExecutionException: Failed to execute goal com.jayway.maven.plugins.android.generation2:android-maven-plugin:3.4.1:apk (default-apk) on project gogodroid: 
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:217)
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:153)
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:145)
    at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:84)
    at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:59)
    at org.apache.maven.lifecycle.internal.LifecycleStarter.singleThreadedBuild(LifecycleStarter.java:183)
    at org.apache.maven.lifecycle.internal.LifecycleStarter.execute(LifecycleStarter.java:161)
    at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:320)
    at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:156)
    at org.apache.maven.cli.MavenCli.execute(MavenCli.java:537)
    at org.apache.maven.cli.MavenCli.doMain(MavenCli.java:196)
    at org.apache.maven.cli.MavenCli.main(MavenCli.java:141)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
    at java.lang.reflect.Method.invoke(Method.java:597)
    at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced(Launcher.java:290)
    at org.codehaus.plexus.classworlds.launcher.Launcher.launch(Launcher.java:230)
    at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode(Launcher.java:409)
    at org.codehaus.plexus.classworlds.launcher.Launcher.main(Launcher.java:352)
Caused by: org.apache.maven.plugin.MojoExecutionException: 
    at com.jayway.maven.plugins.android.phase09package.ApkMojo.generateIntermediateApk(ApkMojo.java:1103)
    at com.jayway.maven.plugins.android.phase09package.ApkMojo.execute(ApkMojo.java:287)
    at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:101)
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:209)
    ... 19 more
Caused by: com.jayway.maven.plugins.android.ExecutionException: ANDROID-040-001: Could not execute: Command = /bin/sh -c cd /Users/adrian/Development/projects/GogoDroid && /Users/adrian/Development/bin/android-sdk-macosx/platform-tools/aapt package -f -M /Users/adrian/Development/projects/GogoDroid/AndroidManifest.xml -S /Users/adrian/Development/projects/GogoDroid/res -S /Users/adrian/Development/projects/GogoDroid/target/unpack/apklibs/org.holoeverywhere_library_apklib_1.4.0/res -S /Users/adrian/Development/projects/GogoDroid/target/unpack/apklibs/com.actionbarsherlock_actionbarsherlock_apklib_4.2.0/res -S /Users/adrian/Development/projects/GogoDroid/target/unpack/apklibs/com.facebook.android_Facebook_apklib_3.0.0/res --auto-add-overlay -A /Users/adrian/Development/projects/GogoDroid/target/generated-sources/combined-assets/assets -I /Users/adrian/Development/bin/android-sdk-macosx/platforms/android-16/android.jar -F /Users/adrian/Development/projects/GogoDroid/target/gogodroid.ap_, Result = 1
    at com.jayway.maven.plugins.android.CommandExecutor$Factory$1.executeCommand(CommandExecutor.java:339)
    at com.jayway.maven.plugins.android.phase09package.ApkMojo.generateIntermediateApk(ApkMojo.java:1099)
    ... 22 more
[ERROR] 
[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/MojoExecutionException
➜  GogoDroid git:(feature/build_script) ✗ mvn -v
Apache Maven 3.0.4 (r1232337; 2012-01-17 00:44:56-0800)
Maven home: /usr/local/Cellar/maven/3.0.4/libexec
Java version: 1.6.0_29, vendor: Apple Inc.
Java home: /Library/Java/JavaVirtualMachines/1.6.0_29-b11-402.jdk/Contents/Home
Default locale: en_US, platform encoding: MacRoman
OS name: "mac os x", version: "10.7.5", arch: "x86_64", family: "mac"

Does anyone have a clue what is going on? The only other strange thing I am noticing is that there seems to be a lot of odd resource debug messages before the build actually fails.

(Messages before the actual failure)

INFO] /Users/adrian/Development/projects/GogoDroid/res/drawable/tab_trips_selector.xml:14: error: Error: No resource found that matches the given name (at 'drawable' with value '@drawable/tab_trip_ic_sel').
[INFO] /Users/adrian/Development/projects/GogoDroid/res/drawable/tab_trips_selector.xml:15: error: Error: No resource found that matches the given name (at 'drawable' with value '@drawable/tab_trip_ic_sel').
[INFO] /Users/adrian/Development/projects/GogoDroid/res/drawable/tab_trips_selector.xml:18: error: Error: No resource found that matches the given name (at 'drawable' with value '@drawable/tab_trip_ic').
[INFO] /Users/adrian/Development/projects/GogoDroid/res/drawable/tab_trips_selector.xml:19: error: Error: No resource found that matches the given name (at 'drawable' with value '@drawable/tab_trip_ic_sel').
[INFO] /Users/adrian/Development/projects/GogoDroid/res/menu/feed_menu.xml:4: error: Error: No resource found that matches the given name (at 'icon' with value '@drawable/refresh_ic').
[INFO] /Users/adrian/Development/projects/GogoDroid/res/menu/me_menu.xml:4: error: Error: No resource found that matches the given name (at 'icon' with value '@drawable/ab_invite_ic').
[INFO] /Users/adrian/Development/projects/GogoDroid/res/menu/moment_menu.xml:4: error: Error: No resource found that matches the given name (at 'icon' with value '@drawable/ab_info_ic').

Thanks for help in advance.

Update 1 - Here is the pom for reference, I just updated the plugin to 3.5.0 but am still seeing the same errors. It is still something to do with the resources. It looks like

<?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>
    <packaging>apk</packaging>
    <!-- Omitted Group Info -->


    <dependencies>
        <dependency>
            <groupId>com.google.android</groupId>
            <artifactId>android</artifactId>
            <version>4.1.1.4</version>
            <scope>provided</scope>
        </dependency>
        <dependency>
            <groupId>org.holoeverywhere</groupId>
            <artifactId>library</artifactId>
            <version>1.4.0</version>
            <type>apklib</type>
        </dependency>
        <dependency>
            <groupId>joda-time</groupId>
            <artifactId>joda-time</artifactId>
            <version>1.5.2</version>
            <type>jar</type>
        </dependency>
        <dependency>
            <groupId>org.roboguice</groupId>
            <artifactId>roboguice</artifactId>
            <version>2.0</version>
            <type>jar</type>
        </dependency>
        <dependency>
            <groupId>net.hockeyapp.android</groupId>
            <artifactId>HockeySDK</artifactId>
            <version>2.2.1</version>
            <type>jar</type>
        </dependency>
        <dependency>
            <groupId>org.apache.amber</groupId>
            <artifactId>amber-oauth2-client</artifactId>
            <version>0.22-incubating</version>
            <type>jar</type>
        </dependency>
        <dependency>
            <groupId>com.actionbarsherlock</groupId>
            <artifactId>actionbarsherlock</artifactId>
            <version>4.2.0</version>
            <type>apklib</type>
        </dependency>


        <dependency>
            <groupId>com.github.kevinsawicki</groupId>
            <artifactId>urbanairship-lib</artifactId>
            <version>2.0.2</version>
        </dependency>


        <dependency>
            <groupId>com.google.android.maps</groupId>
            <artifactId>maps</artifactId>
            <version>16_r3</version>
            <scope>provided</scope>
        </dependency>
    <!--    <dependency>
            <groupId>android.support</groupId>
            <artifactId>compatibility-v4</artifactId>
            <version>11</version>
        </dependency>    -->
        <dependency>
            <groupId>com.androidquery</groupId>
            <artifactId>aquery</artifactId>
            <version>0.22.10</version>
        </dependency>
        <dependency>
            <groupId>com.commonsware.cwac.adapter</groupId>
            <artifactId>AdapterWrapper</artifactId>
            <version>1.0</version>
        </dependency>
        <dependency>
            <groupId>com.commonsware.cwac.endless</groupId>
            <artifactId>EndlessAdapter</artifactId>
            <version>1.0</version>
        </dependency>
        <dependency>
            <groupId>com.facebook.android</groupId>
            <artifactId>Facebook</artifactId>
            <version>3.0.0</version>
            <exclusions>
                <exclusion>
                    <groupId>android.support</groupId>
                    <artifactId>compatibility-v4</artifactId>
                </exclusion>
            </exclusions>
            <type>apklib</type>
        </dependency>

    </dependencies>


    <build>
        <finalName>${project.artifactId}</finalName>
        <sourceDirectory>src</sourceDirectory>
        <pluginManagement>
            <plugins>
                <plugin>
                    <groupId>com.jayway.maven.plugins.android.generation2</groupId>
                    <artifactId>android-maven-plugin</artifactId>
                    <version>3.5.0</version>
                    <extensions>true</extensions>
                </plugin>
            </plugins>
        </pluginManagement>
        <plugins>
            <plugin>
                <groupId>com.jayway.maven.plugins.android.generation2</groupId>
                <artifactId>android-maven-plugin</artifactId>
                <configuration>
                    <sdk>
                        <path>/Users/adrian/Development/bin/android-sdk-macosx</path>
                        <platform>4.1.2</platform>
                    </sdk>
                    <extractDuplicates>true</extractDuplicates>
                    <undeployBeforeDeploy>true</undeployBeforeDeploy>
                </configuration>
            </plugin>
        </plugins>
    </build>

</project>

Update 2 - It looks like it's a problem specific to Android Maven complaining about my 9.patch images not really being 9.patch images. Eclipse and Intellij compile the apks fine though ... does someone have a way to make maven android behave like Eclipse and Intellij?

JJD
  • 50,076
  • 60
  • 203
  • 339
adrian
  • 2,326
  • 2
  • 32
  • 48
  • Can you post your pom.xml and can you re-check that your layout's is not missing any images... – Thalaivar Dec 20 '12 at 11:11
  • It compiles fine when I am using IntelliJ, unless I am missing something it should be the same? – adrian Dec 20 '12 at 20:21
  • possible duplicate of [com.jayway.maven.plugins.android.generation2: Plugin execution not covered by lifecycle configuration?](http://stackoverflow.com/questions/13554694/com-jayway-maven-plugins-android-generation2-plugin-execution-not-covered-by-li) – givanse Dec 30 '13 at 20:54

2 Answers2

0

I feel that you are using older version of Maven-Plugin. Update your pom.xml with the latest version and try to compile.

https://groups.google.com/forum/#!topic/maven-android-developers/w5H0oRWJN9I/discussion

Thalaivar
  • 23,282
  • 5
  • 60
  • 71
  • Just did what you said ... didn't work, any other suggestions? – adrian Dec 20 '12 at 20:20
  • It looks like it's related to this problem ... http://stackoverflow.com/questions/13248258/android-maven-plugin-v3-4-0-cannot-find-drawable-resources-when-building-app, but I'm not sure what the solution is – adrian Dec 20 '12 at 22:33
0

Just in case nothing works for you, go to your project in Jenkins -> Workspace -> and then Wipe Out Current workspace and try to make a new build.

This fixed the ExecutionException: ANDROID-040-001 for me.

Andy Res
  • 15,963
  • 5
  • 60
  • 96