我已经导入了一个项目到Android工作室的几个子项目。
我想运行一个子项目。
我成功地完成了这个子项目的构建。Gradle作为一个模块。
为了运行它,我去运行>编辑配置> + > Android应用程序。
问题:当我尝试选择一个模块时,下拉列表中没有显示。
为什么会这样?
编辑:它在Groovy下显示为一个模块,但在Android应用程序下不显示。我如何让它显示在Android应用程序?
我已经导入了一个项目到Android工作室的几个子项目。
我想运行一个子项目。
我成功地完成了这个子项目的构建。Gradle作为一个模块。
为了运行它,我去运行>编辑配置> + > Android应用程序。
问题:当我尝试选择一个模块时,下拉列表中没有显示。
为什么会这样?
编辑:它在Groovy下显示为一个模块,但在Android应用程序下不显示。我如何让它显示在Android应用程序?
当前回答
如果以上都不起作用。尝试更新你的Android工作室版本。 步骤: 1. 在Android Studio中,选择文件>设置(或Android Studio >偏好在Mac上)。 2. 在左侧窗格中,选择“外观和行为”>“系统设置”>“更新”。 3.确保选中了“自动检查更新”,然后从下拉列表中选择一个频道。 4. 单击OK。
其他回答
对我来说,重启Android Studio就能解决这个问题。就像《Eclipse》的美好时光
在我的情况下,问题来自build.gradle(app)中的更高(或未下载)compileSdkVersion和targetSdkVersion。 这是因为克隆项目在另一台电脑,没有下载该sdk镜像。
我通过以下方法在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 :)
goto Android >> Gradle脚本>>构建Gradle(模块:app)
确保这个文件的第一行是这样的。
apply plugin: 'com.android.application'
不是这样的
apply plugin: 'com.android.library'
有时错误存在于Android-manifest中,因为那里 是交叉像图像运行/调试配置,因此试图看 如果Android-manifest有任何错误,以防万一。