2011-10-25 108 views
2

我跟着如何使用PlayN與Maven的指導,但是當我執行命令:Maven的安裝失敗

 
    maven install 

失敗。

錯誤日誌如下:

 
    [INFO] 
    [INFO] --- maven-android-plugin:3.0.0-alpha-2:dex (default-dex) @ playn-showcase-android --- 
    [INFO] /usr/lib/jvm/java-6-openjdk/jre/bin/java [-Xmx1024m, -jar, /opt/android-sdk/platform-tools/lib/dx.jar, --dex, --output=/home/hox/Projects/playn/playn/sample/showcase/android/target/classes.dex, /home/hox/Projects/playn/playn/sample/showcase/android/target/android-classes] 
    [INFO] 
    [INFO] --- maven-jar-plugin:2.3.2:jar (default-jar) @ playn-showcase-android --- 
    [INFO] Building jar: /home/hox/Projects/playn/playn/sample/showcase/android/target/playn-showcase-android-1.0-SNAPSHOT.jar 
    [INFO] 
    [INFO] --- maven-android-plugin:3.0.0-alpha-2:apk (default-apk) @ playn-showcase-android --- 
    [INFO] /opt/android-sdk/platform-tools/aapt [package, -f, -M, /home/hox/Projects/playn/playn/sample/showcase/android/AndroidManifest.xml, -S, /home/hox/Projects/playn/playn/sample/showcase/android/res, --auto-add-overlay, -I, /opt/android-sdk/platforms/android-11/android.jar, -F, /home/hox/Projects/playn/playn/sample/showcase/android/target/playn-showcase-android-1.0-SNAPSHOT.ap_] 
    [ERROR] Cannot create the APKBuilder object 
    java.lang.NullPointerException 
     at com.jayway.maven.plugins.android.phase09package.ApkBuilder.(ApkBuilder.java:195) 
     at com.jayway.maven.plugins.android.phase09package.ApkMojo.doAPKWithAPKBuilder(ApkMojo.java:334) 
     at com.jayway.maven.plugins.android.phase09package.ApkMojo.createApkFile(ApkMojo.java:249) 
     at com.jayway.maven.plugins.android.phase09package.ApkMojo.execute(ApkMojo.java:207) 
     at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:101) 
     at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:209) 
     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:319) 
     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:57) 
     at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) 
     at java.lang.reflect.Method.invoke(Method.java:616) 
     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) 
    [INFO] ------------------------------------------------------------------------ 
    [INFO] Reactor Summary: 
    [INFO] 
    [INFO] PlayN Project ..................................... SUCCESS [0.125s] 
    [INFO] PlayN Project Archetype ........................... SUCCESS [0.650s] 
    [INFO] PlayN Core ........................................ SUCCESS [1.962s] 
    [INFO] PlayN JBox2D ...................................... SUCCESS [2.125s] 
    [INFO] PlayN WebGL ....................................... SUCCESS [0.914s] 
    [INFO] PlayN Java ........................................ SUCCESS [1.740s] 
    [INFO] PlayN HTML ........................................ SUCCESS [1.419s] 
    [INFO] PlayN Flash ....................................... SUCCESS [1.414s] 
    [INFO] PlayN Android ..................................... SUCCESS [1.552s] 
    [INFO] PlayN Server ...................................... SUCCESS [0.524s] 
    [INFO] PlayN Demos Project ............................... SUCCESS [0.002s] 
    [INFO] PlayN Hello Metaproject ........................... SUCCESS [0.003s] 
    [INFO] PlayN Hello Core .................................. SUCCESS [0.574s] 
    [INFO] PlayN Hello HTML .................................. SUCCESS [18.829s] 
    [INFO] PlayN Hello Flash ................................. SUCCESS [22.045s] 
    [INFO] PlayN Hello Android ............................... SUCCESS [14.519s] 
    [INFO] PlayN Showcase Metaproject ........................ SUCCESS [0.003s] 
    [INFO] PlayN Showcase Core ............................... SUCCESS [1.567s] 
    [INFO] PlayN Showcase HTML ............................... SUCCESS [21.663s] 
    [INFO] PlayN Showcase Flash .............................. SUCCESS [35.783s] 
    [INFO] PlayN Showcase Android ............................ FAILURE [11.533s] 
    [INFO] PlayN Cute Metaproject ............................ SKIPPED 
    [INFO] PlayN Cute Core ................................... SKIPPED 
    [INFO] PlayN Cute HTML ................................... SKIPPED 
    [INFO] PlayN Cute Flash .................................. SKIPPED 
    [INFO] PlayN Cute Android ................................ SKIPPED 
    [INFO] PlayN Payments .................................... SKIPPED 
    [INFO] PlayN Payments Core ............................... SKIPPED 
    [INFO] PlayN Payments Demo Metaproject ................... SKIPPED 
    [INFO] PlayN Payments Demo Core .......................... SKIPPED 
    [INFO] PlayN payments HTML ............................... SKIPPED 
    [INFO] PlayN payments Server ............................. SKIPPED 
    [INFO] PlayN Payments Demo HTML .......................... SKIPPED 
    [INFO] PlayN Tests Metaproject ........................... SKIPPED 
    [INFO] PlayN Benchmark Metaproject ....................... SKIPPED 
    [INFO] PlayN Benchmarks Core ............................. SKIPPED 
    [INFO] PlayN Benchmark HTML .............................. SKIPPED 
    [INFO] PlayN Manual Tests Metaproject .................... SKIPPED 
    [INFO] PlayN Manual Tests Core ........................... SKIPPED 
    [INFO] PlayN Manual Tests HTML ........................... SKIPPED 
    [INFO] PlayN Manual Tests Flash .......................... SKIPPED 
    [INFO] ------------------------------------------------------------------------ 
    [INFO] BUILD FAILURE 
    [INFO] ------------------------------------------------------------------------ 
    [INFO] Total time: 2:20.302s 
    [INFO] Finished at: Tue Oct 25 15:44:44 CEST 2011 
    [INFO] Final Memory: 122M/318M 
    [INFO] ------------------------------------------------------------------------ 
    [ERROR] Failed to execute goal com.jayway.maven.plugins.android.generation2:maven-android-plugin:3.0.0-alpha-2:apk (default-apk) on project playn-showcase-android: Cannot create the APKBuilder object: NullPointerException -> [Help 1] 
    [ERROR] 
    [ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch. 
    [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 read the following articles: 
    [ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoExecutionException 
    [ERROR] 
    [ERROR] After correcting the problems, you can resume the build with the command 
    [ERROR] mvn -rf :playn-showcase-android 

我發現了同樣的錯誤here,但沒有解決方案。

回答

4

您是否使用最近發佈的Android SDK的r14?這似乎與Playn使用的Maven Android插件版本存在一些問題。試着用以下替換插件部分samples/showcase/android/pom.xml

<plugins> 
    <plugin> 
    <groupId>com.jayway.maven.plugins.android.generation2</groupId> 
    <artifactId>android-maven-plugin</artifactId> 
    <version>3.0.0</version> 
    <configuration> 
     <androidManifestFile>${project.basedir}/AndroidManifest.xml</androidManifestFile> 
     <assetsDirectory>${project.basedir}/assets</assetsDirectory> 
     <resourceDirectory>${project.basedir}/res</resourceDirectory> 
     <sdk> 
     <platform>11</platform> 
     </sdk> 
     <undeployBeforeDeploy>true</undeployBeforeDeploy> 
     <jvmArguments> 
     <jvmArgument>-Xmx1024m</jvmArgument> 
     </jvmArguments> 
     <dex> 
     <jvmArguments> 
      <jvmArgument>-Xmx1024m</jvmArgument> 
     </jvmArguments> 
     </dex> 
    </configuration> 
    <extensions>true</extensions> 
    </plugin> 
</plugins> 

然後cd到樣品/展示並運行,然後MVN安裝MVN清潔。

如果有效,我會在今天晚些時候升級所有示例以使用最新的android maven插件。

+0

它的工作原理!我對可愛的示例做了同樣的改變,現在_mvn install_可以工作。謝謝 –

+0

太棒了!我只是更新回購使用新版本,所以你應該能夠拉動,它會全部建立。 –

+0

這個問題似乎與ADT rel15持續存在。您的解決方案奏效+1 – kostja