2012-12-20 69 views
3

所以我在使用android插件的時候遇到了編譯錯誤。使用android 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" 

有沒有人有線索是怎麼回事?我注意到的唯一另外一件奇怪的事情是,在構建失敗之前似乎有很多奇怪的資源調試消息。

(實際故障之前的消息)

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'). 

感謝提前的幫助。

更新1 - 這裏是供參考的pom,我只是更新了插件到3.5.0,但仍然看到相同的錯誤。這仍然與資源有關。它看起來像

<?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> 

更新2 - 它看起來就像是抱怨我9.patch圖像實際上不是9.patch圖像具體到Android Maven的一個問題。 Eclipse和Intellij編譯的確很好......但有人有辦法讓maven的android像Eclipse和Intellij一樣行事嗎?

+0

你可以發佈你的pom.xml,並且你可以重新檢查你的佈局是不是缺少任何圖像... – Thalaivar

+0

它編譯罰款時,我使用IntelliJ,除非我失去了它應該是相同的東西? – adrian

+0

[com.jayway.maven.plugins.android.generation2:插件執行未覆蓋生命週期配置?]的可能的副本(http://stackoverflow.com/questions/13554694/com-jayway-maven-plugins-android-generation2 -plugin-execution-not-covered-by-li) – givanse

回答

0

我覺得你使用的是舊版本的Maven-Plugin。用最新版本更新你的pom.xml並嘗試編譯。

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

+0

剛剛做了你所說的......沒有工作,還有其他建議嗎? – adrian

+0

它看起來像它與這個問題有關... http://stackoverflow.com/questions/13248258/android-maven-plugin-v3-4-0-cannot-find-drawable-resources-when-building-app,但我不確定解決方案是什麼 – adrian

0

萬一沒有爲你工作,去你的項目詹金斯 - >工作空間 - >然後消滅當前工作區,並設法使一個新的版本。

這爲我修復了ExecutionException:ANDROID-040-001。