我已经导入了一个项目到Android工作室的几个子项目。
我想运行一个子项目。
我成功地完成了这个子项目的构建。Gradle作为一个模块。
为了运行它,我去运行>编辑配置> + > Android应用程序。
问题:当我尝试选择一个模块时,下拉列表中没有显示。
为什么会这样?
编辑:它在Groovy下显示为一个模块,但在Android应用程序下不显示。我如何让它显示在Android应用程序?
我已经导入了一个项目到Android工作室的几个子项目。
我想运行一个子项目。
我成功地完成了这个子项目的构建。Gradle作为一个模块。
为了运行它,我去运行>编辑配置> + > Android应用程序。
问题:当我尝试选择一个模块时,下拉列表中没有显示。
为什么会这样?
编辑:它在Groovy下显示为一个模块,但在Android应用程序下不显示。我如何让它显示在Android应用程序?
当前回答
对我来说,重启Android Studio就能解决这个问题。就像《Eclipse》的美好时光
其他回答
我试过了所有的办法,但都不成功。所以我最终得到了我的工作解。只需做以下步骤:
如果android studio打开,关闭它。 将模块(项目)复制到当前工作区。 启动android studio。 您将在项目结构中看到添加的模块。 打开设置。gradle的项目,并包括':YOUR_MODULE_NAME'。 同步gradle,你可以看到模块成功添加到你的项目。
新项目。通过点击“文件->同步项目与Gradle文件”修正了这个问题
我通过以下方法在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 :)
在模块设置对话框中删除并重新添加Android和Android- gradle facet后,我修复了这个问题。
goto Android >> Gradle脚本>>构建Gradle(模块:app)
确保这个文件的第一行是这样的。
apply plugin: 'com.android.application'
不是这样的
apply plugin: 'com.android.library'