sajith4u / maven-android-plugin

Automatically exported from code.google.com/p/maven-android-plugin
0 stars 0 forks source link

Null Pointer Exception 3.8.0 : AndroidSdk.getPathForBuildTool( #432

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1. Maven 3.1.1, maven-android-plugin 3.8.0, try to compile.

What is the expected output?

A correct compilation

What do you see instead?

An Null Pointer Exception error log:

[ERROR] Failed to execute goal 
com.jayway.maven.plugins.android.generation2:android-maven-plugin:3.8.0:generate
-sources (default-generate-sources) on project poke-nodes-android: Execution 
default-generate-sources of goal 
com.jayway.maven.plugins.android.generation2:android-maven-plugin:3.8.0:generate
-sources failed. NullPointerException -> [Help 1]
org.apache.maven.lifecycle.LifecycleExecutionException: Failed to execute goal 
com.jayway.maven.plugins.android.generation2:android-maven-plugin:3.8.0:generate
-sources (default-generate-sources) on project poke-nodes-android: Execution 
default-generate-sources of goal 
com.jayway.maven.plugins.android.generation2:android-maven-plugin:3.8.0:generate
-sources failed.
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:224)
    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:317)
    at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:152)
    at org.apache.maven.cli.MavenCli.execute(MavenCli.java:555)
    at org.apache.maven.cli.MavenCli.doMain(MavenCli.java:214)
    at org.apache.maven.cli.MavenCli.main(MavenCli.java:158)
    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:606)
    at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced(Launcher.java:289)
    at org.codehaus.plexus.classworlds.launcher.Launcher.launch(Launcher.java:229)
    at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode(Launcher.java:415)
    at org.codehaus.plexus.classworlds.launcher.Launcher.main(Launcher.java:356)
Caused by: org.apache.maven.plugin.PluginExecutionException: Execution 
default-generate-sources of goal 
com.jayway.maven.plugins.android.generation2:android-maven-plugin:3.8.0:generate
-sources failed.
    at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:115)
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:208)
    ... 19 more
Caused by: java.lang.NullPointerException
    at com.jayway.maven.plugins.android.AndroidSdk.getPathForBuildTool(AndroidSdk.java:251)
    at com.jayway.maven.plugins.android.AndroidSdk.getAaptPath(AndroidSdk.java:157)
    at com.jayway.maven.plugins.android.phase01generatesources.GenerateSourcesMojo.generateR(GenerateSourcesMojo.java:569)
    at com.jayway.maven.plugins.android.phase01generatesources.GenerateSourcesMojo.execute(GenerateSourcesMojo.java:211)
    at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:106)
    ... 20 more

What version of maven-android-plugin are you using?

3.8.0

What are the complete output lines of "mvn -version" on your machine?

Apache Maven 3.1.1 (NON-CANONICAL_2013-10-11_13-55_root; 2013-10-11 
09:55:32+0000)
Maven home: /opt/maven
Java version: 1.7.0_45, vendor: Oracle Corporation
Java home: /usr/lib/jvm/java-7-openjdk/jre
Default locale: en_US, platform encoding: UTF-8
OS name: "linux", version: "3.12.1-3-arch", arch: "amd64", family: "unix"

Please provide any additional information below.

I've set the ANDROID_SDK path variable, and set the sdk location in the maven 
settings.

-e / -X output for the android-maven-plugin:

[DEBUG] Configuring mojo 
com.jayway.maven.plugins.android.generation2:android-maven-plugin:3.8.0:generate
-sources from plugin realm 
ClassRealm[plugin>com.jayway.maven.plugins.android.generation2:android-maven-plu
gin:3.8.0, parent: sun.misc.Launcher$AppClassLoader@2cdb03a1]
[DEBUG] Configuring mojo 
'com.jayway.maven.plugins.android.generation2:android-maven-plugin:3.8.0:generat
e-sources' with basic configurator -->
[DEBUG]   (f) aaptExtraArgs = []
[DEBUG]   (f) androidManifestFile = 
/home/methius/Code/Java/games/poke-nodes/android/AndroidManifest.xml
[DEBUG]   (f) assetsDirectory = 
/home/methius/Code/Java/games/poke-nodes/android/../assets
[DEBUG]   (f) attachJar = true
[DEBUG]   (f) attachSources = false
[DEBUG]   (f) buildConfigConstants = []
[DEBUG]   (f) combinedAssets = 
/home/methius/Code/Java/games/poke-nodes/android/target/generated-sources/combin
ed-assets/assets
[DEBUG]   (f) combinedRes = 
/home/methius/Code/Java/games/poke-nodes/android/target/generated-sources/combin
ed-resources/res
[DEBUG]   (f) envAndroidHome = /opt/android-sdk
[DEBUG]   (f) extractedDependenciesAssets = 
/home/methius/Code/Java/games/poke-nodes/android/target/generated-sources/extrac
ted-dependencies/assets
[DEBUG]   (f) extractedDependenciesDirectory = 
/home/methius/Code/Java/games/poke-nodes/android/target/generated-sources/extrac
ted-dependencies
[DEBUG]   (f) extractedDependenciesJavaResources = 
/home/methius/Code/Java/games/poke-nodes/android/target/generated-sources/extrac
ted-dependencies/src/main/resources
[DEBUG]   (f) extractedDependenciesJavaSources = 
/home/methius/Code/Java/games/poke-nodes/android/target/generated-sources/extrac
ted-dependencies/src/main/java
[DEBUG]   (f) extractedDependenciesRes = 
/home/methius/Code/Java/games/poke-nodes/android/target/generated-sources/extrac
ted-dependencies/res
[DEBUG]   (f) genDirectory = 
/home/methius/Code/Java/games/poke-nodes/android/target/generated-sources/r
[DEBUG]   (f) genDirectoryAidl = 
/home/methius/Code/Java/games/poke-nodes/android/target/generated-sources/aidl
[DEBUG]   (f) generateApk = true
[DEBUG]   (f) mergeManifests = false
[DEBUG]   (f) nativeLibrariesDirectory = 
/home/methius/Code/Java/games/poke-nodes/android/libs
[DEBUG]   (f) project = MavenProject: 
net.codepoke.games:poke-nodes-android:0.1-SNAPSHOT @ 
/home/methius/Code/Java/games/poke-nodes/android/pom.xml
[DEBUG]   (f) projectRepos = [codepoke.net 
(http://codepoke.net:8081/artifactory/repo, releases+snapshots), gdx-nightlies 
(https://oss.sonatype.org/content/repositories/snapshots/, releases+snapshots), 
central (http://repo.maven.apache.org/maven2, releases)]
[DEBUG]   (f) release = false
[DEBUG]   (f) repoSession = 
org.eclipse.aether.DefaultRepositorySystemSession@77a22fe3
[DEBUG]   (f) resourceDirectory = 
/home/methius/Code/Java/games/poke-nodes/android/res
[DEBUG]   (f) resourceOverlayDirectory = 
/home/methius/Code/Java/games/poke-nodes/android/res-overlay
[DEBUG]   (f) platform = 17
[DEBUG]   (f) sdk = com.jayway.maven.plugins.android.configuration.Sdk@260702ee
[DEBUG]   (f) sdkPath = /opt/android-sdk
[DEBUG]   (f) session = org.apache.maven.execution.MavenSession@44ca9a6d
[DEBUG]   (f) sourceDirectory = 
/home/methius/Code/Java/games/poke-nodes/android/src/main/java
[DEBUG]   (f) undeployBeforeDeploy = true
[DEBUG]   (f) unpackedApkLibsDirectory = 
/home/methius/Code/Java/games/poke-nodes/android/target/unpack/apklibs

Original issue reported on code.google.com by Lume...@gmail.com on 28 Nov 2013 at 10:30

GoogleCodeExporter commented 9 years ago
If possible; could the links be removed from the issue?
Not that they're that important, but no reason to leave them in.

Apparently I cannot edit the issue anymore :)
Sorry for the mixup

Original comment by Lume...@gmail.com on 28 Nov 2013 at 10:38

GoogleCodeExporter commented 9 years ago
Please update your SDK to the latest version and test again. 

Original comment by mosa...@gmail.com on 18 Dec 2013 at 7:07

GoogleCodeExporter commented 9 years ago
I was having this same issue - make sure you have the build-tools package 
installed from the Android SDK manager.

Original comment by chris.pe...@gmail.com on 20 Dec 2013 at 10:34

GoogleCodeExporter commented 9 years ago
ty

build-tools was indeed what I was missing

Original comment by vict...@groupon.com on 24 Jan 2014 at 9:13

GoogleCodeExporter commented 9 years ago
Alway have NullpointerException with 3.8.2. NPE are evil. 

Original comment by damien.g...@gmail.com on 30 Jan 2014 at 12:41

GoogleCodeExporter commented 9 years ago

Original comment by william....@xandar.com.au on 27 Feb 2014 at 10:34

GoogleCodeExporter commented 9 years ago
Pull request merged and fix will go out with 4.0.0

Original comment by mosa...@gmail.com on 30 May 2014 at 4:27