0

我在 64 位机器上运行 ubuntu 12.04 并且在运行由 intellij 提供支持的 Android Studio 时遇到此错误。我在 SUN JDK 1.7(64 位)上运行它。我该如何解决这个问题?

堆栈跟踪:

java.lang.NullPointerException
    at java.io.File.<init>(File.java:251)
    at com.android.tools.idea.startup.AndroidStudioSpecificInitializer.getSubFolders(AndroidStudioSpecificInitializer.java:302)
    at com.android.tools.idea.startup.AndroidStudioSpecificInitializer.getJdkHome(AndroidStudioSpecificInitializer.java:252)
    at com.android.tools.idea.startup.AndroidStudioSpecificInitializer.setupSdks(AndroidStudioSpecificInitializer.java:87)
    at com.android.tools.idea.startup.AndroidStudioSpecificInitializer.run(AndroidStudioSpecificInitializer.java:62)
    at com.android.tools.idea.AndroidInitialConfigurator.activateAndroidStudioInitializerExtensions(AndroidInitialConfigurator.java:115)
    at com.android.tools.idea.AndroidInitialConfigurator.<init>(AndroidInitialConfigurator.java:54)
    at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
    at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:57)
    at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
    at java.lang.reflect.Constructor.newInstance(Constructor.java:525)
    at org.picocontainer.defaults.InstantiatingComponentAdapter.newInstance(InstantiatingComponentAdapter.java:193)
    at org.picocontainer.defaults.ConstructorInjectionComponentAdapter$1.run(ConstructorInjectionComponentAdapter.java:220)
    at org.picocontainer.defaults.ThreadLocalCyclicDependencyGuard.observe(ThreadLocalCyclicDependencyGuard.java:53)
    at org.picocontainer.defaults.ConstructorInjectionComponentAdapter.getComponentInstance(ConstructorInjectionComponentAdapter.java:248)
    at org.picocontainer.defaults.DecoratingComponentAdapter.getComponentInstance(DecoratingComponentAdapter.java:60)
    at org.picocontainer.defaults.CachingComponentAdapter.getComponentInstance(CachingComponentAdapter.java:58)
    at com.intellij.openapi.components.impl.ComponentManagerImpl$ComponentConfigComponentAdapter$1.getComponentInstance(ComponentManagerImpl.java:575)
    at com.intellij.openapi.components.impl.ComponentManagerImpl$ComponentConfigComponentAdapter.getComponentInstance(ComponentManagerImpl.java:633)
    at com.intellij.util.pico.DefaultPicoContainer.getLocalInstance(DefaultPicoContainer.java:241)
    at com.intellij.util.pico.DefaultPicoContainer.getInstance(DefaultPicoContainer.java:228)
    at com.intellij.util.pico.DefaultPicoContainer.getComponentInstance(DefaultPicoContainer.java:215)
    at org.picocontainer.alternatives.AbstractDelegatingMutablePicoContainer.getComponentInstance(AbstractDelegatingMutablePicoContainer.java:75)
    at com.intellij.openapi.components.impl.ComponentManagerImpl.createComponent(ComponentManagerImpl.java:131)
    at com.intellij.openapi.application.impl.ApplicationImpl.createComponent(ApplicationImpl.java:416)
    at com.intellij.openapi.components.impl.ComponentManagerImpl.createComponents(ComponentManagerImpl.java:112)
    at com.intellij.openapi.components.impl.ComponentManagerImpl.initComponents(ComponentManagerImpl.java:357)
    at com.intellij.openapi.components.impl.stores.ApplicationStoreImpl.load(ApplicationStoreImpl.java:87)
    at com.intellij.openapi.application.impl.ApplicationImpl.load(ApplicationImpl.java:548)
    at com.intellij.idea.IdeaApplication.run(IdeaApplication.java:143)
    at com.intellij.idea.MainImpl$1.run(MainImpl.java:87)
    at java.awt.event.InvocationEvent.dispatch(InvocationEvent.java:251)
    at java.awt.EventQueue.dispatchEventImpl(EventQueue.java:727)
    at java.awt.EventQueue.access$200(EventQueue.java:103)
    at java.awt.EventQueue$3.run(EventQueue.java:688)
    at java.awt.EventQueue$3.run(EventQueue.java:686)
    at java.security.AccessController.doPrivileged(Native Method)
    at java.security.ProtectionDomain$1.doIntersectionPrivilege(ProtectionDomain.java:76)
    at java.awt.EventQueue.dispatchEvent(EventQueue.java:697)
    at com.intellij.ide.IdeEventQueue.defaultDispatchEvent(IdeEventQueue.java:700)
    at com.intellij.ide.IdeEventQueue._dispatchEvent(IdeEventQueue.java:525)
    at com.intellij.ide.IdeEventQueue.dispatchEvent(IdeEventQueue.java:348)
    at java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:242)
    at java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:161)
    at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:150)
    at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:146)
    at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:138)
    at java.awt.EventDispatchThread.run(EventDispatchThread.java:91)
4

1 回答 1

0

查看错误:http ://code.google.com/p/android/issues/detail?id=55299

解决方法:

sudo ln -s $JAVA_HOME /usr/java

(或 /opt/java 或 /usr/lib/jvm)

于 2013-05-20T19:21:08.703 回答