BigKarel / maven-android-plugin

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

NPE in AndroidSdk.getPathForBuildTool #397

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
I recently upgraded my maven configuration:
<plugin>            
            <groupId>com.jayway.maven.plugins.android.generation2</groupId>
                <artifactId>android-maven-plugin</artifactId>
                <version>3.6.0</version>
                <configuration>
                    <androidManifestFile>${project.basedir}/AndroidManifest.xml</androidManifestFile>
                    <assetsDirectory>${project.basedir}/assets</assetsDirectory>
                    <resourceDirectory>${project.basedir}/res</resourceDirectory>
                    <nativeLibrariesDirectory>${project.basedir}/src/main/native</nativeLibrariesDirectory>
                    <sdk>
                        <platform>17</platform>
                        <path>C:\Users\BLA\android-sdks\</path>
                    </sdk>
                    <undeployBeforeDeploy>true</undeployBeforeDeploy>
                </configuration>
                <extensions>true</extensions>
            </plugin>

What is the expected output?
I would expect the compilation to succeed

What do you see instead?
[ERROR] Failed to execute goal com.jayway.maven.plugins.android.generation2:andr
oid-maven-plugin:3.6.0:generate-sources (default-generate-sources) on project wi
shset-android: Execution default-generate-sources of goal com.jayway.maven.plugi
ns.android.generation2:android-maven-plugin:3.6.0:generate-sources failed. NullP
ointerException -> [Help 1]
org.apache.maven.lifecycle.LifecycleExecutionException: Failed to execute goal c
om.jayway.maven.plugins.android.generation2:android-maven-plugin:3.6.0:generate-
sources (default-generate-sources) on project wishset-android: Execution default
-generate-sources of goal com.jayway.maven.plugins.android.generation2:android-m
aven-plugin:3.6.0:generate-sources failed.
        at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor
.java:225)
        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.buildProje
ct(LifecycleModuleBuilder.java:84)
        at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProje
ct(LifecycleModuleBuilder.java:59)
        at org.apache.maven.lifecycle.internal.LifecycleStarter.singleThreadedBu
ild(LifecycleStarter.java:183)
        at org.apache.maven.lifecycle.internal.LifecycleStarter.execute(Lifecycl
eStarter.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:57)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAcces
sorImpl.java:43)
        at java.lang.reflect.Method.invoke(Method.java:601)
        at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced(Laun
cher.java:290)
        at org.codehaus.plexus.classworlds.launcher.Launcher.launch(Launcher.jav
a:230)
        at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode(La
uncher.java:409)
        at org.codehaus.plexus.classworlds.launcher.Launcher.main(Launcher.java:
352)
Caused by: org.apache.maven.plugin.PluginExecutionException: Execution default-g
enerate-sources of goal com.jayway.maven.plugins.android.generation2:android-mav
en-plugin:3.6.0:generate-sources failed.
        at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(Default
BuildPluginManager.java:110)
        at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor
.java:209)
        ... 19 more
Caused by: java.lang.NullPointerException
        at com.jayway.maven.plugins.android.AndroidSdk.getPathForBuildTool(Andro
idSdk.java:270)
        at com.jayway.maven.plugins.android.AndroidSdk.getAaptPath(AndroidSdk.ja
va:176)
        at com.jayway.maven.plugins.android.phase01generatesources.GenerateSourc
esMojo.generateR(GenerateSourcesMojo.java:477)
        at com.jayway.maven.plugins.android.phase01generatesources.GenerateSourc
esMojo.execute(GenerateSourcesMojo.java:195)
        at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(Default
BuildPluginManager.java:101)
        ... 20 more

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

What are the complete output lines of "mvn -version" on your machine?
$ mvn -version
Apache Maven 3.0.4 (r1232337; 2012-01-17 09:44:56+0100)
Maven home: d:\dev\tools\apache-maven-3.0.4
Java version: 1.7.0_13, vendor: Oracle Corporation
Java home: c:\Program Files\Java\jdk1.7.0_13\jre
Default locale: fr_FR, platform encoding: Cp1252
OS name: "windows 7", version: "6.1", arch: "amd64", family: "windows"

Original issue reported on code.google.com by benoit.l...@gmail.com on 14 Jun 2013 at 5:57

GoogleCodeExporter commented 9 years ago
The command run is
mvn install -X

Original comment by benoit.l...@gmail.com on 14 Jun 2013 at 5:58

GoogleCodeExporter commented 9 years ago
Addind the symbolic links as described in ISSUE-377 solved this issue

Original comment by benoit.l...@gmail.com on 14 Jun 2013 at 2:58

GoogleCodeExporter commented 9 years ago
I am now getting this null pointer exception and adding the symlinks hasn't 
worked for me. I may have missed a step with setting up the Android SDK, but if 
so, something to catch the problem and report it before it becomes a NPE might 
be useful.

Original comment by ross.fen...@gmail.com on 30 Jun 2013 at 5:01

GoogleCodeExporter commented 9 years ago
Same for me. But strangely enough my configuration works locally but fails with 
this error on Travis CI. You can find an example on RoboSpice repo on github.

It fails both with 3.6.0 and 3.6.1 and SDK 16 and 17

Original comment by steff.ni...@gmail.com on 15 Sep 2013 at 8:13

GoogleCodeExporter commented 9 years ago
Upgrade your SDK to 22 x and the plugin to 3.8.2

Original comment by mosa...@gmail.com on 31 Dec 2013 at 7:14

GoogleCodeExporter commented 9 years ago
Same error with SDK 22 and the plugins 3.6.0, 3.8.2 and 3.9.0-rc2
The issue is not fixed...

Original comment by lorenzo....@gmail.com on 29 May 2014 at 9:00

GoogleCodeExporter commented 9 years ago
Please raise the issue at https://github.com/jayway/maven-android-plugin/issues
And include a link to a github project in which this fails.

Original comment by william....@xandar.com.au on 29 May 2014 at 9:10

GoogleCodeExporter commented 9 years ago
And the problem was: there where no build tools. The sdk manager failed to 
install them, so the $SDK_HOME/build-tools directory was empty. Since this is 
quite a common problem, I would suggest that a check on the result of 
getBuildTools() would be beneficial.

Original comment by lorenzo....@gmail.com on 29 May 2014 at 9:13

GoogleCodeExporter commented 9 years ago
Cool. Look forward to your pull request.

Original comment by william....@xandar.com.au on 29 May 2014 at 9:15

GoogleCodeExporter commented 9 years ago
Pull request merged. Fix is in master and will go out with 4.0.0

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