2013-08-28 121 views
0

我有一個我在Eclipse中構建的Android項目,我希望將其移植到Android Studio。即使Android Studio在沒有gradle構建文件的情況下也能正常工作,但我想使用Eclipse ADT創建它們,如here所述。在Eclipse中生成Gradle時出錯ADT

但是,當試圖生成Gradle文件時,只要點擊「完成」,Eclipse就會向我顯示錯誤日誌。我試圖解碼它的意思,但無濟於事。

這裏是有問題的錯誤:

java.lang.reflect.InvocationTargetException 
at org.eclipse.jface.operation.ModalContext.runInCurrentThread(ModalContext.java:477) 
at org.eclipse.jface.operation.ModalContext.run(ModalContext.java:372) 
at org.eclipse.jface.wizard.WizardDialog.run(WizardDialog.java:1028) 
at com.android.ide.eclipse.adt.internal.wizards.exportgradle.GradleExportPage.generateBuildfiles(GradleExportPage.java:293) 
at com.android.ide.eclipse.adt.internal.wizards.exportgradle.GradleExportWizard.performFinish(GradleExportWizard.java:32) 
at org.eclipse.jface.wizard.WizardDialog.finishPressed(WizardDialog.java:827) 
at org.eclipse.jface.wizard.WizardDialog.buttonPressed(WizardDialog.java:432) 
at org.eclipse.jface.dialogs.Dialog$2.widgetSelected(Dialog.java:624) 
at org.eclipse.swt.widgets.TypedListener.handleEvent(TypedListener.java:248) 
at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java:84) 
at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1053) 
at org.eclipse.swt.widgets.Display.runDeferredEvents(Display.java:4169) 
at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:3758) 
at org.eclipse.jface.window.Window.runEventLoop(Window.java:825) 
at org.eclipse.jface.window.Window.open(Window.java:801) 
at org.eclipse.ui.internal.handlers.WizardHandler$Export.executeHandler(WizardHandler.java:103) 
at org.eclipse.ui.internal.handlers.WizardHandler.execute(WizardHandler.java:279) 
at org.eclipse.ui.internal.handlers.HandlerProxy.execute(HandlerProxy.java:290) 
at org.eclipse.ui.internal.handlers.E4HandlerProxy.execute(E4HandlerProxy.java:76) 
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.e4.core.internal.di.MethodRequestor.execute(MethodRequestor.java:56) 
at org.eclipse.e4.core.internal.di.InjectorImpl.invokeUsingClass(InjectorImpl.java:231) 
at org.eclipse.e4.core.internal.di.InjectorImpl.invoke(InjectorImpl.java:212) 
at org.eclipse.e4.core.contexts.ContextInjectionFactory.invoke(ContextInjectionFactory.java:131) 
at org.eclipse.e4.core.commands.internal.HandlerServiceImpl.executeHandler(HandlerServiceImpl.java:171) 
at org.eclipse.ui.internal.handlers.LegacyHandlerService.executeCommand(LegacyHandlerService.java:515) 
at org.eclipse.ui.internal.actions.CommandAction.runWithEvent(CommandAction.java:157) 
at org.eclipse.jface.action.ActionContributionItem.handleWidgetSelection(ActionContributionItem.java:584) 
at org.eclipse.jface.action.ActionContributionItem.access$2(ActionContributionItem.java:501) 
at org.eclipse.jface.action.ActionContributionItem$5.handleEvent(ActionContributionItem.java:411) 
at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java:84) 
at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1053) 
at org.eclipse.swt.widgets.Display.runDeferredEvents(Display.java:4169) 
at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:3758) 
at org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine$9.run(PartRenderingEngine.java:1053) 
at org.eclipse.core.databinding.observable.Realm.runWithDefault(Realm.java:332) 
at org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine.run(PartRenderingEngine.java:942) 
at org.eclipse.e4.ui.internal.workbench.E4Workbench.createAndRunUI(E4Workbench.java:86) 
at org.eclipse.ui.internal.Workbench$5.run(Workbench.java:588) 
at org.eclipse.core.databinding.observable.Realm.runWithDefault(Realm.java:332) 
at org.eclipse.ui.internal.Workbench.createAndRunWorkbench(Workbench.java:543) 
at org.eclipse.ui.PlatformUI.createAndRunWorkbench(PlatformUI.java:149) 
at org.eclipse.ui.internal.ide.application.IDEApplication.start(IDEApplication.java:124) 
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:353) 
at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:180) 
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:629) 
at org.eclipse.equinox.launcher.Main.basicRun(Main.java:584) 
at org.eclipse.equinox.launcher.Main.run(Main.java:1438) 
at org.eclipse.equinox.launcher.Main.main(Main.java:1414) 

Caused by: java.lang.NullPointerException 
     at com.android.ide.eclipse.adt.internal.wizards.exportgradle.BuildFileCreator.appendDependencies(BuildFileCreator.java:368) 
     at com.android.ide.eclipse.adt.internal.wizards.exportgradle.BuildFileCreator.createBuildFiles(BuildFileCreator.java:217) 
     at com.android.ide.eclipse.adt.internal.wizards.exportgradle.GradleExportPage$6.run(GradleExportPage.java:274) 
     at org.eclipse.jface.operation.ModalContext.runInCurrentThread(ModalContext.java:464) 
     ... 58 more 

任何人有任何想法,這是什麼意思?代碼編譯良好,並在eclipse和Android Studio中運行(沒有gradle),這就是爲什麼我傻眼了,當然在我的源代碼中沒有任何錯誤導致錯誤

回答

0

我有同樣的錯誤。我可以通過在我試圖導出的項目的根目錄中手動創建一個空的「settings.gradle」文件來解決它。我還必須爲任何其他相關項目(即導出屏幕的「導出模塊」區域中顯示的任何模塊)創建它。

希望這會有所幫助。