导入LibGDX生成的项目时出错

时间:2015-01-19 19:55:36

标签: java android eclipse android-studio libgdx

我在Android Studio中创建了一个名为My Application的新项目。

使用我下载的libgdx设置.jar文件,我创建了一个名为mygame的新项目。

但是,在尝试将项目导入My Application时,我收到了一个断言错误:null。

我根本无法导入libgdx项目!

null
java.lang.AssertionError
at com.android.tools.idea.gradle.project.PreSyncChecks.attemptToUpdateGradleVersionInWrapper(PreSyncChecks.java:174)
at com.android.tools.idea.gradle.project.PreSyncChecks.ensureCorrectGradleSettings(PreSyncChecks.java:72)
at com.android.tools.idea.gradle.project.PreSyncChecks.canSync(PreSyncChecks.java:53)
at com.android.tools.idea.gradle.project.GradleProjectImporter.doImport(GradleProjectImporter.java:430)
at com.android.tools.idea.gradle.project.GradleProjectImporter.doImport(GradleProjectImporter.java:339)
at com.android.tools.idea.gradle.project.GradleProjectImporter.importProject(GradleProjectImporter.java:320)
at com.android.tools.idea.gradle.project.GradleProjectImporter.createProjectFileForGradleProject(GradleProjectImporter.java:142)
at com.android.tools.idea.gradle.project.GradleProjectImporter.importProject(GradleProjectImporter.java:129)
at com.android.tools.idea.actions.AndroidImportProjectAction.createImportWizard(AndroidImportProjectAction.java:165)
at com.android.tools.idea.actions.AndroidImportProjectAction.selectFileAndCreateWizard(AndroidImportProjectAction.java:139)
at com.android.tools.idea.actions.AndroidImportProjectAction.selectFileAndCreateWizard(AndroidImportProjectAction.java:121)
at com.android.tools.idea.actions.AndroidImportProjectAction.actionPerformed(AndroidImportProjectAction.java:82)
at com.intellij.openapi.actionSystem.ex.ActionUtil.performActionDumbAware(ActionUtil.java:164)
at com.intellij.openapi.actionSystem.impl.ActionMenuItem$ActionTransmitter$1.run(ActionMenuItem.java:266)
at com.intellij.openapi.wm.impl.FocusManagerImpl.runOnOwnContext(FocusManagerImpl.java:926)
at com.intellij.openapi.wm.impl.IdeFocusManagerImpl.runOnOwnContext(IdeFocusManagerImpl.java:124)
at com.intellij.openapi.actionSystem.impl.ActionMenuItem$ActionTransmitter.actionPerformed(ActionMenuItem.java:236)
at javax.swing.AbstractButton.fireActionPerformed(AbstractButton.java:2028)
at com.intellij.openapi.actionSystem.impl.ActionMenuItem.fireActionPerformed(ActionMenuItem.java:105)
at javax.swing.AbstractButton$Handler.actionPerformed(AbstractButton.java:2351)
at javax.swing.DefaultButtonModel.fireActionPerformed(DefaultButtonModel.java:387)
at javax.swing.JToggleButton$ToggleButtonModel.setPressed(JToggleButton.java:291)
at javax.swing.AbstractButton.doClick(AbstractButton.java:389)
at com.apple.laf.ScreenMenuItemCheckbox.itemStateChanged(ScreenMenuItemCheckbox.java:178)
at java.awt.CheckboxMenuItem.processItemEvent(CheckboxMenuItem.java:372)
at java.awt.CheckboxMenuItem.processEvent(CheckboxMenuItem.java:340)
at java.awt.MenuComponent.dispatchEventImpl(MenuComponent.java:343)
at java.awt.MenuComponent.dispatchEvent(MenuComponent.java:331)
at java.awt.EventQueue.dispatchEventImpl(EventQueue.java:720)
at java.awt.EventQueue.access$400(EventQueue.java:82)
at java.awt.EventQueue$2.run(EventQueue.java:676)
at java.awt.EventQueue$2.run(EventQueue.java:674)
at java.security.AccessController.doPrivileged(Native Method)
at java.security.AccessControlContext$1.doIntersectionPrivilege(AccessControlContext.java:86)
at java.security.AccessControlContext$1.doIntersectionPrivilege(AccessControlContext.java:97)
at java.awt.EventQueue$3.run(EventQueue.java:690)
at java.awt.EventQueue$3.run(EventQueue.java:688)
at java.security.AccessController.doPrivileged(Native Method)
at java.security.AccessControlContext$1.doIntersectionPrivilege(AccessControlContext.java:86)
at java.awt.EventQueue.dispatchEvent(EventQueue.java:687)
at com.intellij.ide.IdeEventQueue.defaultDispatchEvent(IdeEventQueue.java:697)
at com.intellij.ide.IdeEventQueue._dispatchEvent(IdeEventQueue.java:524)
at com.intellij.ide.IdeEventQueue.dispatchEvent(IdeEventQueue.java:335)
at java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:296)
at java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:211)
at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:201)
at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:196)
at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:188)
at java.awt.EventDispatchThread.run(EventDispatchThread.java:122)

我尝试删除My Application和mygame中的两个.idea文件。但它没有帮助。

1 个答案:

答案 0 :(得分:0)

如果您使用的是Android Gradle插件大于v0.14的IntelliJ IDEA或Android Studio,则可能会出现此错误。

https://youtrack.jetbrains.com/issue/IDEA-134118

尝试从

更改您的gradle构建版本
classpath 'com.android.tools.build:gradle:1.0.0'

classpath 'com.android.tools.build:gradle:0.14.4'

在build.gradle文件中