3

我的项目中有 4 个模块。我可以使用 Android Studio 0.2.0 版创建新模块。

前两天我把Android Studio升级到了0.2.5,现在我去新建一个模块的时候,窗口没有显示任何选项。

新模块窗口提示

我无法通过“文件”->“新建模块”或在“项目工具”窗口中右键单击我的项目名称来执行“新建模块”。

如果我按下完成,Android Studio 会抛出一个NullPointerException. 这是控制台输出:

null 
java.lang.NullPointerException
    at com.android.tools.idea.wizard.TemplateWizardModuleBuilder.createModule(TemplateWizardModuleBuilder.java:177)
    at com.android.tools.idea.wizard.NewModuleWizardrun(NewModuleWizard.java:82)
    at com.intellij.openapi.application.impl.ApplicationImpl.runWriteAction(ApplicationImpl.java:1021)
    at com.android.tools.idea.wizard.NewModuleWizard.createModule(NewModuleWizard.java:79)
    at com.android.tools.idea.actions.AndroidNewModuleAction.actionPerformed(AndroidNewModuleAction.java:45)
    at com.intellij.openapi.actionSystem.ex.ActionUtil.performActionDumbAware(ActionUtil.java:162)
    at com.intellij.openapi.actionSystem.impl.ActionMenuItem$ActionTransmitterrun(ActionMenuItem.java:260)
    at com.intellij.openapi.wm.impl.FocusManagerImpl.runOnOwnContext(FocusManagerImpl.java:892)
    at com.intellij.openapi.wm.impl.IdeFocusManagerImpl.runOnOwnContext(IdeFocusManagerImpl.java:114)
    at com.intellij.openapi.actionSystem.impl.ActionMenuItem$ActionTransmitter.actionPerformed(ActionMenuItem.java:230)
    at javax.swing.AbstractButton.fireActionPerformed(AbstractButton.java:2018)
    at com.intellij.openapi.actionSystem.impl.ActionMenuItem.fireActionPerformed(ActionMenuItem.java:104)
    at com.intellij.ui.plaf.beg.BegMenuItemUI.doClick(BegMenuItemUI.java:512)
    at com.intellij.ui.plaf.beg.BegMenuItemUI.access(BegMenuItemUI.java:44)
    at com.intellij.ui.plaf.beg.BegMenuItemUI$MyMouseInputHandler.mouseReleased(BegMenuItemUI.java:532)
    at java.awt.Component.processMouseEvent(Component.java:6505)
    at javax.swing.JComponent.processMouseEvent(JComponent.java:3321)
    at java.awt.Component.processEvent(Component.java:6270)
    at java.awt.Container.processEvent(Container.java:2229)
    at java.awt.Component.dispatchEventImpl(Component.java:4861)
    at java.awt.Container.dispatchEventImpl(Container.java:2287)
    at java.awt.Component.dispatchEvent(Component.java:4687)
    at java.awt.LightweightDispatcher.retargetMouseEvent(Container.java:4832)
    at java.awt.LightweightDispatcher.processMouseEvent(Container.java:4492)
    at java.awt.LightweightDispatcher.dispatchEvent(Container.java:4422)
    at java.awt.Container.dispatchEventImpl(Container.java:2273)
    at java.awt.Window.dispatchEventImpl(Window.java:2719)
    at java.awt.Component.dispatchEvent(Component.java:4687)
    at java.awt.EventQueue.dispatchEventImpl(EventQueue.java:703)
    at java.awt.EventQueue.access(EventQueue.java:102)
    at java.awt.EventQueuerun(EventQueue.java:662)
    at java.awt.EventQueuerun(EventQueue.java:660)
    at java.security.AccessController.doPrivileged(Native Method)
    at java.security.ProtectionDomaindoIntersectionPrivilege(ProtectionDomain.java:76)
    at java.security.ProtectionDomaindoIntersectionPrivilege(ProtectionDomain.java:87)
    at java.awt.EventQueuerun(EventQueue.java:676)
    at java.awt.EventQueuerun(EventQueue.java:674)
    at java.security.AccessController.doPrivileged(Native Method)
    at java.security.ProtectionDomaindoIntersectionPrivilege(ProtectionDomain.java:76)
    at java.awt.EventQueue.dispatchEvent(EventQueue.java:673)
    at com.intellij.ide.IdeEventQueue.defaultDispatchEvent(IdeEventQueue.java:679)
    at com.intellij.ide.IdeEventQueue._dispatchEvent(IdeEventQueue.java:503)
    at com.intellij.ide.IdeEventQueue.dispatchEvent(IdeEventQueue.java:332)
    at java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:244)
    at java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:163)
    at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:151)
    at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:147)
    at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:139)
    at java.awt.EventDispatchThread.run(EventDispatchThread.java:97)
4

1 回答 1

0

我可以通过手动创建一个新文件夹并复制/粘贴来添加一个新模块:

  • 另一个模块 IML 文件(之后重命名)
  • 来自另一个模块的 build.gradle 文件
  • 手动创建所有 Android 文件(Manifest、RES 文件、SRC 文件)

然后,如果您重新启动 Android Studio,它应该会看到一个新模块。

这不是最好的解决方案,但同时也是一种解决方法。

于 2013-08-21T20:49:12.063 回答