Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

java.lang.NullPointerException when creating first android app in ADT Mac Bundle

When trying to create a new Android Application, I can get through the whole wizard until the very end, when clicking finish gives me an error:

Errors running builder 'Android Resource Manager' on project 'test'. java.lang.NullPointerException

I have tried reinstalling ADT multiple times to no avail. Does anyone know what my issue is here? I have the SDKs for the APIs that I'm trying to use.

EDIT: not sure if its of any help, but when looking at the ADT update site in 'install new software', I am presented by the error

Error while reading from repository: http://dl-ssl.google.com/android/eclipse/site.xml.

Thanks, John

like image 907
John W Avatar asked Aug 06 '13 22:08

John W


2 Answers

I have had this error, and have finally solved it for my situation.

I am currently running Mavericks and had installed Java 1.7.0_55 and Eclipse Java EE Kepler SR2 64bit. I successfully installed the ADT plugin on Eclipse, and everything seemed to work but I was getting the same

Errors running builder 'Android Resource Manager' on project 'test'. java.lang.NullPointerException

error when I tried to create a new android app project.

I finally decided to install Java 1.6 (http://support.apple.com/kb/DL1572) and the ADT Bundle. Running Eclipse from the ADT Bundle worked fine, but still had the same error due to Eclipse using Java 1.7 instead of 1.6. To get Eclipse to use a different version, I added

<string>-vm</string><string>/System/Library/Frameworks/JavaVM.framework/Versions/1.6.0/Commands/java</string>

to <adt-bundle-directory>/eclipse/Eclipse.app/Contents/Info.plist. This solved the error, and I can now create a new Android project and run another version of Eclipse with Java 1.7. (Look at the comments in the Info.plist file to figure out where to add the option string.)

For some reason, setting my own version of Eclipse (Java EE Kepler SR2 and not the one in the ADT bundle) to use Java 1.6 does not work (Eclipse no longer has the Null pointer error, but it hangs when creating a project).

I guess I should have just followed the System Requirements for Android (Java 1.6) from the beginning, which would have saved me from all this grief. I am converting over from Windows, which has no problem using Java 1.7 for Android development, which I incorrectly assumed(hoped) would be true for MacOS.

like image 90
Albert Park Avatar answered Nov 02 '22 06:11

Albert Park


Had the same problem and already solved, not so far away from Gavin's method.

I add this instead of Gavin's on eclipse.ini before -vmargs

-vm
/System/Library/Frameworks/JavaVM.framework/Versions/1.6/Commands/java
like image 38
ginginza Avatar answered Nov 02 '22 06:11

ginginza