Android Studio Gradle 已部署模块

Android Studio Gradle Already disposed Module(Android Studio Gradle 已部署模块)
本文介绍了Android Studio Gradle 已部署模块的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

问题描述

我已经安装了 Android Studio 1.0.1 版.我已经从 eclipse 导入了我的项目,它工作正常.然后我删除了一个模块并将其重新导入到我的 Android Studio 项目中.gradle build 说BUILD SUCCESSFUL",但它会弹出一个带有消息的警报窗口

I have installed Android Studio version 1.0.1. I have imported my projects from eclipse and it works fine. Then I deleted a module and reimported it into my Android Studio project. The gradle build says "BUILD SUCCESSFUL" but it pops up an alert window with the message

未能完成 Gradle 执行.原因:已处置:模块:'MYMODULENAME'

我现在无法启动我的应用程序.知道我能做什么吗?

I can't start my app now. Any idea what I can do?

我通过以下说明解决了这个问题:

I solved the problem with the following instructions:

  1. 将项目视图从 Android 切换到 Project
  2. 删除 settings.gradle 中包含MYMODULENAME"的条目
  3. 模块符号中的蓝色框不显示.然后您可以在上下文菜单中删除该模块
  4. 导入模块

推荐答案

注意:这纯粹是 IDEA/AS 问题,gradlew clean |构建 > 清洁 |Build > Rebuild 只会浪费你的时间.

Note: this is purely an IDEA/AS issue, gradlew clean | Build > Clean | Build > Rebuild will just waste your time.

这里的大多数解决方案都是在黑暗中盲目刺伤.以下是我发现的根本原因:

Most of the solutions here are blind stabbings in the dark. Here's what I found to be the root cause:

  1. 某些 .iml 文件可能丢失(可能是因为我们删除了它),检查模块错误是否有 .iml.
  2. 如果缺少,检查 .idea/modules.xml 是否有该模块的条目
  1. Some of the .iml files may be missing (maybe because we deleted it), check if the module erroring has .iml.
  2. If it is missing, check if .idea/modules.xml has an entry for that module

同步时,我注意到 IDEA/AS 尝试将一个新的重复条目放入 .idea/modules.xml 中,而已经有一个.在同步尝试重置内存中的模块时,此重复条目可能会被处理两次.

While syncing I noticed that IDEA/AS tries to put a new duplicate entry into .idea/modules.xml while there's already one. This duplicate entry is probably disposed of twice while the sync tries to reset the modules in memory.

快速解决方案:为了使其正常工作,最简单的方法是删除 .idea/modules.xml 以及 .iml 文件.另外可能值得删除 .idea/modules/ 文件夹(如果存在).重新启动 Android Studio(无需清除缓存)并强制从 Gradle 视图或工具栏同步 Gradle 以重新创建文件.

Quick Solution: In order to make it work the easiest is to delete .idea/modules.xml along with the .iml files. Additionally may worth deleting .idea/modules/ folder if it exists. Restart Android Studio (no need to clear cache) and force a Gradle sync from Gradle view or toolbar to recreate the files.

这篇关于Android Studio Gradle 已部署模块的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

本站部分内容来源互联网,如果有图片或者内容侵犯您的权益请联系我们删除!

相关文档推荐

Android release APK crash with java.lang.AssertionError: impossible in java.lang.Enum(Android 发布 APK 因 java.lang.AssertionError 崩溃:在 java.lang.Enum 中不可能)
Finished with Non Zero Exit Value 3(以非零退出值 3 结束)
On gradle:3.0.0 More than one file was found with OS independent path #39;META-INF/ASL2.0#39;(在 gradle:3.0.0 上找到多个文件,其独立于操作系统的路径为“META-INF/ASL2.0)
Android : app loading library at runtime on Lollipop but not IceCreamSandwich(Android:运行时在 Lollipop 上而不是 IceCreamSandwich 上的应用程序加载库)
buildConfigField depending on flavor + buildType(buildConfigField 取决于风味 + buildType)
How do I suppress warnings when compiling an android library with gradle?(使用 gradle 编译 android 库时如何抑制警告?)