修复了Google API task-android-sample的内存不足错误

时间:2012-01-21 07:57:14

标签: java android eclipse

我正在尝试运行在Google Api Java Client

处给出的Task-Android-sample

我安装了eclipse,Java 6和Android插件但没有maven,所以我所做的就是

  1. 我复制了TasksSample.java文件并将其粘贴到我的Starting Activity文件中。
  2. 将google-api-java-client-1.6.0-beta jar文件添加到我的项目中(构建路径,添加外部jar)
  3. 从“Task Jar file”下载任务API jar文件并导入到我的项目
  4. 多次尝试但未能成功打开ClientCredentials.java,因此我将其删除并使用Google Api Console
  5. 获取的密钥替换了ClientCredentials.KEY
  6. 创建了一个512MB内存的虚拟设备,用于“Google API,Google API,Android API 8”
  7. 然而它一次又一次地给我同样的错误“内存不足”错误,eclipse正在关闭。
  8. 任何人都可以帮助我吗?我尝试了这个问题StackOverflow Question on Task-Sample Example提供的所有帮助,但无法根除错误。我已经尝试过去2天运行一个使用google Api中的任何一个的示例程序但是到目前为止我还没有成功。请帮帮我。

    弹出一个对话框,标题=“发生问题”内容 - “无法执行dex:GC开销限制超出GC开销限制”。它有2个按钮OK和<

    1. 标题 - Android启动内容 - 您的项目包含错误,请在运行您的应用程序之前修复它们
    2. 标题 - 内部错误内容 - 显示内部错误时,建议您退出工作台。
    3. 日志 - [2012-01-21 14:24:13 - Dex Loader]无法执行dex:超出GC开销限制 [2012-01-21 14:24:13 - google_api_ex]转换为Dalvik格式失败:无法执行dex:超出GC开销限制

      .log文件输出

      !ENTRY com.android.ide.eclipse.adt 4 0 2012-01-21 14:21:25.945
      !MESSAGE Unable to execute dex: GC overhead limit exceeded
      !STACK 0
      java.lang.OutOfMemoryError: GC overhead limit exceeded
          at java.util.Arrays.copyOfRange(Unknown Source)
          at java.lang.String.<init>(Unknown Source)
          at java.lang.StringBuilder.toString(Unknown Source)
          at com.android.dx.rop.type.Prototype.withFirstParameter(Prototype.java:370)
          at com.android.dx.rop.code.Rops.ropFor(Rops.java:1210)
          at com.android.dx.cf.code.RopperMachine.run(RopperMachine.java:478)
          at com.android.dx.cf.code.Simulator$SimVisitor.visitConstant(Simulator.java:692)
          at com.android.dx.cf.code.BytecodeArray.parseInstruction(BytecodeArray.java:763)
          at com.android.dx.cf.code.Simulator.simulate(Simulator.java:95)
          at com.android.dx.cf.code.Ropper.processBlock(Ropper.java:684)
          at com.android.dx.cf.code.Ropper.doit(Ropper.java:639)
          at com.android.dx.cf.code.Ropper.convert(Ropper.java:252)
          at com.android.dx.dex.cf.CfTranslator.processMethods(CfTranslator.java:256)
          at com.android.dx.dex.cf.CfTranslator.translate0(CfTranslator.java:134)
          at com.android.dx.dex.cf.CfTranslator.translate(CfTranslator.java:87)
          at com.android.dx.command.dexer.Main.processClass(Main.java:483)
          at com.android.dx.command.dexer.Main.processFileBytes(Main.java:455)
          at com.android.dx.command.dexer.Main.access$400(Main.java:67)
          at com.android.dx.command.dexer.Main$1.processFileBytes(Main.java:394)
          at com.android.dx.cf.direct.ClassPathOpener.processArchive(ClassPathOpener.java:245)
          at com.android.dx.cf.direct.ClassPathOpener.processOne(ClassPathOpener.java:131)
          at com.android.dx.cf.direct.ClassPathOpener.process(ClassPathOpener.java:109)
          at com.android.dx.command.dexer.Main.processOne(Main.java:418)
          at com.android.dx.command.dexer.Main.processAllFiles(Main.java:329)
          at com.android.dx.command.dexer.Main.run(Main.java:206)
          at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
          at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
          at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
          at java.lang.reflect.Method.invoke(Unknown Source)
          at com.android.ide.eclipse.adt.internal.build.DexWrapper.run(DexWrapper.java:179)
          at com.android.ide.eclipse.adt.internal.build.BuildHelper.executeDx(BuildHelper.java:745)
          at com.android.ide.eclipse.adt.internal.build.builders.PostCompilerBuilder.build(PostCompilerBuilder.java:634)
      
      !ENTRY org.eclipse.ui 4 0 2012-01-21 14:24:29.723
      !MESSAGE Unhandled event loop exception
      !STACK 0
      org.eclipse.swt.SWTException: Failed to execute runnable (java.lang.OutOfMemoryError: Java heap space)
          at org.eclipse.swt.SWT.error(SWT.java:4282)
          at org.eclipse.swt.SWT.error(SWT.java:4197)
          at org.eclipse.swt.widgets.Synchronizer.runAsyncMessages(Synchronizer.java:138)
          at org.eclipse.swt.widgets.Display.runAsyncMessages(Display.java:4140)
          at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:3757)
          at org.eclipse.jface.window.Window.runEventLoop(Window.java:825)
          at org.eclipse.jface.window.Window.open(Window.java:801)
          at org.eclipse.jface.dialogs.MessageDialog.open(MessageDialog.java:334)
          at org.eclipse.jface.dialogs.MessageDialog.open(MessageDialog.java:364)
          at org.eclipse.jface.dialogs.MessageDialog.openError(MessageDialog.java:431)
          at com.android.ide.eclipse.adt.AdtPlugin$4.run(AdtPlugin.java:839)
          at org.eclipse.swt.widgets.RunnableLock.run(RunnableLock.java:35)
          at org.eclipse.swt.widgets.Synchronizer.runAsyncMessages(Synchronizer.java:135)
          at org.eclipse.swt.widgets.Display.runAsyncMessages(Display.java:4140)
          at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:3757)
          at org.eclipse.jface.window.Window.runEventLoop(Window.java:825)
          at org.eclipse.jface.window.Window.open(Window.java:801)
          at org.eclipse.jface.dialogs.MessageDialog.open(MessageDialog.java:334)
          at org.eclipse.ui.internal.ide.dialogs.InternalErrorDialog.open(InternalErrorDialog.java:80)
          at org.eclipse.ui.internal.ide.IDEWorkbenchErrorHandler.openQuestionDialog(IDEWorkbenchErrorHandler.java:199)
          at org.eclipse.ui.internal.ide.IDEWorkbenchErrorHandler.handleException(IDEWorkbenchErrorHandler.java:154)
          at org.eclipse.ui.internal.ide.IDEWorkbenchErrorHandler.access$0(IDEWorkbenchErrorHandler.java:146)
          at org.eclipse.ui.internal.ide.IDEWorkbenchErrorHandler$1.runInUIThread(IDEWorkbenchErrorHandler.java:121)
          at org.eclipse.ui.progress.UIJob$1.run(UIJob.java:95)
          at org.eclipse.swt.widgets.RunnableLock.run(RunnableLock.java:35)
          at org.eclipse.swt.widgets.Synchronizer.runAsyncMessages(Synchronizer.java:135)
          at org.eclipse.swt.widgets.Display.runAsyncMessages(Display.java:4140)
          at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:3757)
          at org.eclipse.ui.internal.Workbench.runEventLoop(Workbench.java:2696)
          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)
          at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.start(EclipseAppLauncher.java:79)
          at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:344)
          at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:179)
          at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
          at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
          at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
          at java.lang.reflect.Method.invoke(Unknown Source)
          at org.eclipse.equinox.launcher.Main.invokeFramework(Main.java:622)
          at org.eclipse.equinox.launcher.Main.basicRun(Main.java:577)
          at org.eclipse.equinox.launcher.Main.run(Main.java:1410)
          at org.eclipse.equinox.launcher.Main.main(Main.java:1386)
      Caused by: java.lang.OutOfMemoryError: Java heap space
          at org.eclipse.swt.widgets.Composite.WM_PRINTCLIENT(Composite.java:1618)
          at org.eclipse.swt.widgets.Control.windowProc(Control.java:4590)
          at org.eclipse.swt.widgets.Display.windowProc(Display.java:4972)
          at org.eclipse.swt.internal.win32.OS.CallWindowProcW(Native Method)
          at org.eclipse.swt.internal.win32.OS.CallWindowProc(OS.java:2425)
          at org.eclipse.swt.widgets.ProgressBar.callWindowProc(ProgressBar.java:116)
          at org.eclipse.swt.widgets.Control.windowProc(Control.java:4623)
          at org.eclipse.swt.widgets.Display.windowProc(Display.java:4972)
          at org.eclipse.swt.internal.win32.OS.DispatchMessageW(Native Method)
          at org.eclipse.swt.internal.win32.OS.DispatchMessage(OS.java:2531)
          at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:3752)
          at org.eclipse.ui.statushandlers.WorkbenchErrorHandler.showStatusAdapter(WorkbenchErrorHandler.java:107)
          at org.eclipse.ui.statushandlers.WorkbenchErrorHandler.access$0(WorkbenchErrorHandler.java:94)
          at org.eclipse.ui.statushandlers.WorkbenchErrorHandler$1.run(WorkbenchErrorHandler.java:62)
          at org.eclipse.ui.internal.UILockListener.doPendingWork(UILockListener.java:164)
          at org.eclipse.ui.internal.UISynchronizer$3.run(UISynchronizer.java:158)
          at org.eclipse.swt.widgets.RunnableLock.run(RunnableLock.java:35)
          at org.eclipse.swt.widgets.Synchronizer.runAsyncMessages(Synchronizer.java:135)
          at org.eclipse.swt.widgets.Display.runAsyncMessages(Display.java:4140)
          at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:3757)
          at org.eclipse.jface.window.Window.runEventLoop(Window.java:825)
          at org.eclipse.jface.window.Window.open(Window.java:801)
          at org.eclipse.jface.dialogs.MessageDialog.open(MessageDialog.java:334)
          at org.eclipse.jface.dialogs.MessageDialog.open(MessageDialog.java:364)
          at org.eclipse.jface.dialogs.MessageDialog.openError(MessageDialog.java:431)
          at com.android.ide.eclipse.adt.AdtPlugin$4.run(AdtPlugin.java:839)
          at org.eclipse.swt.widgets.RunnableLock.run(RunnableLock.java:35)
          at org.eclipse.swt.widgets.Synchronizer.runAsyncMessages(Synchronizer.java:135)
          at org.eclipse.swt.widgets.Display.runAsyncMessages(Display.java:4140)
          at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:3757)
          at org.eclipse.jface.window.Window.runEventLoop(Window.java:825)
          at org.eclipse.jface.window.Window.open(Window.java:801)
      
      !ENTRY org.eclipse.core.jobs 4 2 2012-01-21 14:24:29.749
      !MESSAGE An internal error occurred during: "Periodic workspace save.".
      !STACK 0
      java.lang.OutOfMemoryError: GC overhead limit exceeded
          at org.eclipse.core.internal.dtree.DataDeltaNode.simplifyWithParent(DataDeltaNode.java:96)
          at org.eclipse.core.internal.dtree.AbstractDataTreeNode.simplifyWithParent(AbstractDataTreeNode.java:501)
          at org.eclipse.core.internal.dtree.NoDataDeltaNode.simplifyWithParent(NoDataDeltaNode.java:107)
          at org.eclipse.core.internal.dtree.AbstractDataTreeNode.simplifyWithParent(AbstractDataTreeNode.java:501)
          at org.eclipse.core.internal.dtree.NoDataDeltaNode.simplifyWithParent(NoDataDeltaNode.java:107)
          at org.eclipse.core.internal.dtree.AbstractDataTreeNode.simplifyWithParent(AbstractDataTreeNode.java:501)
          at org.eclipse.core.internal.dtree.NoDataDeltaNode.simplifyWithParent(NoDataDeltaNode.java:107)
          at org.eclipse.core.internal.dtree.AbstractDataTreeNode.simplifyWithParent(AbstractDataTreeNode.java:501)
          at org.eclipse.core.internal.dtree.NoDataDeltaNode.simplifyWithParent(NoDataDeltaNode.java:107)
          at org.eclipse.core.internal.dtree.AbstractDataTreeNode.simplifyWithParent(AbstractDataTreeNode.java:501)
          at org.eclipse.core.internal.dtree.NoDataDeltaNode.simplifyWithParent(NoDataDeltaNode.java:107)
          at org.eclipse.core.internal.dtree.AbstractDataTreeNode.simplifyWithParent(AbstractDataTreeNode.java:501)
          at org.eclipse.core.internal.dtree.NoDataDeltaNode.simplifyWithParent(NoDataDeltaNode.java:107)
          at org.eclipse.core.internal.dtree.AbstractDataTreeNode.simplifyWithParent(AbstractDataTreeNode.java:501)
          at org.eclipse.core.internal.dtree.DataDeltaNode.simplifyWithParent(DataDeltaNode.java:93)
          at org.eclipse.core.internal.dtree.AbstractDataTreeNode.simplifyWithParent(AbstractDataTreeNode.java:501)
          at org.eclipse.core.internal.dtree.DataDeltaNode.simplifyWithParent(DataDeltaNode.java:93)
          at org.eclipse.core.internal.dtree.DeltaDataTree.simplify(DeltaDataTree.java:945)
          at org.eclipse.core.internal.dtree.DeltaDataTree.forwardDeltaWith(DeltaDataTree.java:450)
          at org.eclipse.core.internal.dtree.DeltaDataTree.forwardDeltaWith(DeltaDataTree.java:453)
          at org.eclipse.core.internal.watson.ElementTreeWriter.writeDelta(ElementTreeWriter.java:158)
          at org.eclipse.core.internal.resources.SaveManager.snapTree(SaveManager.java:1452)
          at org.eclipse.core.internal.resources.SaveManager.save(SaveManager.java:1162)
          at org.eclipse.core.internal.resources.SaveManager.save(SaveManager.java:1108)
          at org.eclipse.core.internal.resources.DelayedSnapshotJob.run(DelayedSnapshotJob.java:51)
          at org.eclipse.core.internal.jobs.Worker.run(Worker.java:54)
      

1 个答案:

答案 0 :(得分:0)

我想通了,实际上我正在添加我从google-api-java-client-1.6.0-beta.zip文件获得的所有jar文件,并且有些增加了项目的大小,所以通过减少他们以最低要求,我能够运行该项目。仍然不清楚为什么Android Project出现这个问题,因为我一直在我的办公室工作Java Web应用程序项目,并且它附带了100多个罐子,但我在eclipse上运行该项目时从未遇到此错误。那为什么在Android上?