我已经导入了一个项目到Android工作室的几个子项目。

我想运行一个子项目。

我成功地完成了这个子项目的构建。Gradle作为一个模块。

为了运行它,我去运行>编辑配置> + > Android应用程序。

问题:当我尝试选择一个模块时,下拉列表中没有显示。

为什么会这样?

编辑:它在Groovy下显示为一个模块,但在Android应用程序下不显示。我如何让它显示在Android应用程序?


当前回答

我通过以下方法在Android Studio 1.3.1中修复了这个问题:

Make a new module from File -> New -> New Module Name it something different, e.g. 'My Libary' Copy an .iml file from an existing library module and change the name of the file and rename references in the .iml file Add the module name to settings.gradle Add the module dependency in your app's build.gradle file 'compile project(':mylibrary')' Close and reopen Android Studio Verify that Android Studio recognises the module as a library (should be bold) Rename module's directory and module name by right clicking on the newly created module. Enjoy :)

其他回答

对我来说是:

右键单击应用程序项目文件夹,选择加载/卸载模块… 选择应用模块,单击卸载>,并单击确定 再次右键单击应用程序并选择加载/卸载模块… 选择应用模块,点击<加载>,点击确定

然后,应用程序再次出现在配置列表中。

新项目。通过点击“文件->同步项目与Gradle文件”修正了这个问题

关闭所有Android Studio项目 在Android Studio向导中从最近的项目中删除该项目 重启Android Studio 使用导入选项(导入项目- Gradle, Eclipse ADT等)而不是打开现有的 项目AS项目 同步项目与gradle文件

所有的答案都对我没用。最后,我单击Run > Edit Configuration。在左侧,u可以选择一个新的主模块并删除到已删除的主模块中。

当我选择我的项目的父目录时,我有类似的问题,我通过关闭项目->从Android Studio删除项目->导入项目,选择正确的构建来解决。gradle文件。

确保您选择了正确的构建。导入Gradle文件。