每次打开main.xml时,Eclipse上的Android都会崩溃

时间:2011-08-14 17:22:25

标签: android eclipse crash adt

我将ADT加载到经典Eclipse上。我按照位于此处的Android Helloworld入门指南中的步骤进行操作:http://developer.android.com/resources/tutorials/hello-world.html

每次加载main.xml时都会出现问题。它似乎是ADT插件的一个问题,因为它与它具有的GUI布局编辑器(在后台创建XML)有关。如果我直接访问XML源,它不会崩溃。

我收到了不同的错误消息,内存不足,没有退出信息,以及“checkandloadtargetdata permgen space中的异常”。如果您对我的设置有任何疑问,请随时在评论中发布,我会更新帖子。

我正在运行Windows 7 x64位,安装相当干净。我也有JDK 1.6。以下是位于.metadata中的Eclipse .log文件中的文本。任何帮助将不胜感激。

!SESSION 2011-08-14 13:11:38.628 -----------------------------------------------
eclipse.buildId=I20110613-1736
java.version=1.6.0_26
java.vendor=Sun Microsystems Inc.
BootLoader constants: OS=win32, ARCH=x86_64, WS=win32, NL=en_US
Command-line arguments:  -os win32 -ws win32 -arch x86_64 -debug -console -consoleLog

!ENTRY org.eclipse.ui 4 0 2011-08-14 13:11:51.038
!MESSAGE Unhandled event loop exception
!STACK 0
java.lang.OutOfMemoryError: PermGen space
    at java.lang.ClassLoader.defineClass1(Native Method)
    at java.lang.ClassLoader.defineClassCond(Unknown Source)
    at java.lang.ClassLoader.defineClass(Unknown Source)
    at org.eclipse.osgi.internal.baseadaptor.DefaultClassLoader.defineClass(DefaultClassLoader.java:188)
    at org.eclipse.osgi.baseadaptor.loader.ClasspathManager.defineClass(ClasspathManager.java:601)
    at org.eclipse.osgi.baseadaptor.loader.ClasspathManager.findClassImpl(ClasspathManager.java:567)
    at org.eclipse.osgi.baseadaptor.loader.ClasspathManager.findLocalClassImpl(ClasspathManager.java:490)
    at org.eclipse.osgi.baseadaptor.loader.ClasspathManager.findLocalClass_LockClassLoader(ClasspathManager.java:478)
    at org.eclipse.osgi.baseadaptor.loader.ClasspathManager.findLocalClass(ClasspathManager.java:458)
    at org.eclipse.osgi.internal.baseadaptor.DefaultClassLoader.findLocalClass(DefaultClassLoader.java:216)
    at org.eclipse.osgi.internal.loader.BundleLoader.findLocalClass(BundleLoader.java:400)
    at org.eclipse.osgi.internal.loader.SingleSourcePackage.loadClass(SingleSourcePackage.java:35)
    at org.eclipse.osgi.internal.loader.BundleLoader.findClassInternal(BundleLoader.java:473)
    at org.eclipse.osgi.internal.loader.BundleLoader.findClass(BundleLoader.java:429)
    at org.eclipse.osgi.internal.loader.BundleLoader.findClass(BundleLoader.java:417)
    at org.eclipse.osgi.internal.baseadaptor.DefaultClassLoader.loadClass(DefaultClassLoader.java:107)
    at java.lang.ClassLoader.loadClass(Unknown Source)
    at java.lang.Class.getDeclaredConstructors0(Native Method)
    at java.lang.Class.privateGetDeclaredConstructors(Unknown Source)
    at java.lang.Class.getConstructor0(Unknown Source)
    at java.lang.Class.newInstance0(Unknown Source)
    at java.lang.Class.newInstance(Unknown Source)
    at org.eclipse.core.internal.registry.osgi.RegistryStrategyOSGI.createExecutableExtension(RegistryStrategyOSGI.java:184)
    at org.eclipse.core.internal.registry.ExtensionRegistry.createExecutableExtension(ExtensionRegistry.java:905)
    at org.eclipse.core.internal.registry.ConfigurationElement.createExecutableExtension(ConfigurationElement.java:243)
    at org.eclipse.core.internal.registry.ConfigurationElementHandle.createExecutableExtension(ConfigurationElementHandle.java:55)
    at org.eclipse.ui.internal.WorkbenchPlugin.createExtension(WorkbenchPlugin.java:260)
    at org.eclipse.ui.internal.registry.ViewDescriptor.createView(ViewDescriptor.java:63)
    at org.eclipse.ui.internal.ViewReference.createPartHelper(ViewReference.java:327)
    at org.eclipse.ui.internal.ViewReference.createPart(ViewReference.java:229)
    at org.eclipse.ui.internal.WorkbenchPartReference.getPart(WorkbenchPartReference.java:595)
    at org.eclipse.ui.internal.ViewReference.getView(ViewReference.java:198)

!ENTRY com.android.ide.eclipse.adt 4 0 2011-08-14 13:11:51.043
!MESSAGE Exception in checkAndLoadTargetData.
!STACK 0
java.lang.OutOfMemoryError: PermGen space

!ENTRY org.eclipse.ui 4 0 2011-08-14 13:11:51.056
!MESSAGE Error occurred during status handling
!STACK 0
java.lang.OutOfMemoryError: PermGen space
    at java.lang.ClassLoader.defineClass1(Native Method)
    at java.lang.ClassLoader.defineClassCond(Unknown Source)
    at java.lang.ClassLoader.defineClass(Unknown Source)
    at org.eclipse.osgi.internal.baseadaptor.DefaultClassLoader.defineClass(DefaultClassLoader.java:188)
    at org.eclipse.osgi.baseadaptor.loader.ClasspathManager.defineClass(ClasspathManager.java:601)
    at org.eclipse.osgi.baseadaptor.loader.ClasspathManager.findClassImpl(ClasspathManager.java:567)
    at org.eclipse.osgi.baseadaptor.loader.ClasspathManager.findLocalClassImpl(ClasspathManager.java:490)
    at org.eclipse.osgi.baseadaptor.loader.ClasspathManager.findLocalClass_LockClassLoader(ClasspathManager.java:478)
    at org.eclipse.osgi.baseadaptor.loader.ClasspathManager.findLocalClass(ClasspathManager.java:458)
    at org.eclipse.osgi.internal.baseadaptor.DefaultClassLoader.findLocalClass(DefaultClassLoader.java:216)
    at org.eclipse.osgi.internal.loader.BundleLoader.findLocalClass(BundleLoader.java:400)
    at org.eclipse.osgi.internal.loader.BundleLoader.findClassInternal(BundleLoader.java:476)
    at org.eclipse.osgi.internal.loader.BundleLoader.findClass(BundleLoader.java:429)
    at org.eclipse.osgi.internal.loader.BundleLoader.findClass(BundleLoader.java:417)
    at org.eclipse.osgi.internal.baseadaptor.DefaultClassLoader.loadClass(DefaultClassLoader.java:107)
    at java.lang.ClassLoader.loadClass(Unknown Source)
    at org.eclipse.ui.statushandlers.StatusManager.getStatusHandler(StatusManager.java:135)
    at org.eclipse.ui.statushandlers.StatusManager.handle(StatusManager.java:189)
    at org.eclipse.ui.statushandlers.StatusManager.handle(StatusManager.java:231)
    at org.eclipse.ui.statushandlers.StatusManager.handle(StatusManager.java:242)
    at org.eclipse.ui.application.WorkbenchAdvisor.eventLoopException(WorkbenchAdvisor.java:326)
    at org.eclipse.ui.internal.ExceptionHandler.handleException(ExceptionHandler.java:65)
    at org.eclipse.ui.internal.Workbench.runEventLoop(Workbench.java:2700)
    at org.eclipse.ui.internal.Workbench.runUI(Workbench.java:2660)
    at org.eclipse.ui.internal.Workbench.access$4(Workbench.java:2494)
    at org.eclipse.ui.internal.Workbench$7.run(Workbench.java:674)
    at org.eclipse.core.databinding.observable.Realm.runWithDefault(Realm.java:332)
    at org.eclipse.ui.internal.Workbench.createAndRunWorkbench(Workbench.java:667)
    at org.eclipse.ui.PlatformUI.createAndRunWorkbench(PlatformUI.java:149)
    at org.eclipse.ui.internal.ide.application.IDEApplication.start(IDEApplication.java:123)
    at org.eclipse.equinox.internal.app.EclipseAppHandle.run(EclipseAppHandle.java:196)
    at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.runApplication(EclipseAppLauncher.java:110)

!ENTRY org.eclipse.ui 4 4 2011-08-14 13:13:59.256
!MESSAGE Invalid preference page path: XML Syntax

!ENTRY com.android.ide.eclipse.adt 4 0 2011-08-14 13:13:59.263
!MESSAGE Parsing Data for android-7 failed
!STACK 0
java.lang.OutOfMemoryError: PermGen space

尝试下面的eclipse.ini设置

-startup
plugins/org.eclipse.equinox.launcher_1.2.0.v20110502.jar
--launcher.library
plugins/org.eclipse.equinox.launcher.win32.win32.x86_64_1.1.100.v20110502
-showsplash
org.eclipse.platform
--launcher.defaultAction
openFile
-vmargs
-Xms2048m
-Xmx2048m
-XX:PermSize=1024m
-XX:MaxPermSize=1024m
-XX:+UseParallelGC

我现在得到了一些新东西,因为如果我一直打开Eclipse,那么main.xml已经“打开”了,只是让它在没有做任何事情的情况下流失几秒钟,GUI编辑器出现并且似乎正在工作精细。如果我点击其他任何东西(比如HelloAndroid.java的标签)那么它会锁定并崩溃。

4 个答案:

答案 0 :(得分:4)

我认为你需要增加PermGen的大小。有一篇关于Eclipse Wiki的文章。 1024米就足够了。
无论如何,我的eclipse.ini也应该有所帮助。

cat /opt/eclipse/eclipse.ini
-startup
plugins/org.eclipse.equinox.launcher_1.2.0.v20110502.jar
--launcher.library
plugins/org.eclipse.equinox.launcher.gtk.linux.x86_64_1.1.100.v20110505
-showsplash
org.eclipse.platform
--launcher.defaultAction
openFile
-vmargs
-Xms2048m
-Xmx2048m
-XX:PermSize=1024m
-XX:MaxPermSize=1024m
-XX:+UseParallelGC

答案 1 :(得分:4)

你必须将你的jdk版本升级到最新版本。我发现大多数在线案例是jdk5让eclipse崩溃了,他们通过升级到jdk6来解决问题。我用jdk6但问题就存在了!最后我下载latest version(jdk7),eclipse不再崩溃了!

答案 2 :(得分:0)

我卸载了SDK,删除了我的Eclipse安装,并重新安装了所有内容。

我改变了值得注意的事情。

- 我将Eclipse安装移出程序文件目录,因为我知道Windows以不同的方式对待它。它现在在C:/ Eclipse

- 出于同样的原因,我将Android SDK移出程序文件目录,并确保路径中没有空格。它现在在C:/ androidSDK /

现在似乎工作正常。我想知道在一个程序文件目录中的eclipse与另一个程序文件目录中的SDK之间是否存在冲突。我不知道Windows是否根据它们所在的目录不同地启动这些程序。无论如何,如果你遇到这样的问题,请将它们移出程序文件目录。

答案 3 :(得分:0)

在这篇文章中尝试答案之后。这对我在Windows 7 x64位和JDK 1.7上工作 - 删除麻烦的Eclipse(Mars Java + ADT)并重新安装。我没有对PermSize进行任何更改,但我在eclipse.ini文件中有-Xms512m -Xmx1024m。原始工作区也加载了。