问题描述:

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

网友答案:

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.

网友答案:

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
网友答案:

Albert Park is right, but i have another simple way to fix it.

First you need to check your java version, if it's 1.7.x you just need to remove it by following this article http://docs.oracle.com/javase/7/docs/webnotes/install/mac/mac-jdk.html

Uninstalling the JDK To uninstall the JDK, you must have Administrator privileges and execute the remove command either as root or by using the sudo(8) tool.

Navigate to /Library/Java/JavaVirtualMachines and remove the directory whose name matches the following format:*

/Library/Java/JavaVirtualMachines/jdk<major>.<minor>.<macro[_update]>.jdk

For example, to uninstall 7u6:

% rm -rf jdk1.7.0_06.jdk

That's all.

网友答案:

Finally, I get this thing through.

refer to the eclipse wiki (https://wiki.eclipse.org/Eclipse.ini)

-vm value: Mac OS X Example On a Mac OS X system, you can find eclipse.ini by right-clicking (or Ctrl+click) on the Eclipse executable in Finder, choose Show Package Contents, and then locate eclipse.ini in the MacOS folder under Contents.

To specify Java 6 for OS X:

-vm /System/Library/Frameworks/JavaVM.framework/Versions/1.6.0/Home/bin/java For versions of Mac OS X 10.7+ the location has changed to

/Library/Java/JavaVirtualMachines/<''jdk_name_ver''>/Contents/Home/... To be safer, determine the location for the JDK you intend to use via the utility /usr/libexec/java_home and put this value with .../bin/java appended into the Eclipse.ini file.

because I'm using Mac 10.10. and my java homes are

/usr/libexec/java_home -V
Matching Java Virtual Machines (3):
1.7.0_71, x86_64:   "Java SE 7" /Library/Java/JavaVirtualMachines/jdk1.7.0_71.jdk/Contents/Home
1.6.0_65-b14-466.1, x86_64: "Java SE 6" /System/Library/Java/JavaVirtualMachines/1.6.0.jdk/Contents/Home
1.6.0_65-b14-466.1, i386:   "Java SE 6" /System/Library/Java/JavaVirtualMachines/1.6.0.jdk/Contents/Home

so I add following in eclipse.ini before -vmargs

-vm
/Library/Java/JavaVirtualMachines/jdk1.7.0_71.jdk/Contents/Home/bin/java

That's it!

网友答案:

Try creating a new workspace. Also, instead of reading from the "site.xml" file, just read from the directory itself. However, you shouldn't need to do that if you install the ADT, the plugin is already installed for you. If it still doesn't work, open the application "SDK Manager" in your ADT bundle folder and install everything. You might need to run as admin to do that.

相关阅读:
Top