問題描述
我已經安裝了 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:
- 將項目視圖從 Android 切換到 Project
- 刪除 settings.gradle 中包含MYMODULENAME"的條目
- 模塊符號中的藍色框不顯示.然后您可以在上下文菜單中刪除該模塊
- 導入模塊
推薦答案
注意:這純粹是 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:
- 某些
.iml
文件可能丟失(可能是因為我們刪除了它),檢查模塊錯誤是否有.iml
. - 如果缺少,檢查
.idea/modules.xml
是否有該模塊的條目
- Some of the
.iml
files may be missing (maybe because we deleted it), check if the module erroring has.iml
. - 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 已部署模塊的文章就介紹到這了,希望我們推薦的答案對大家有所幫助,也希望大家多多支持html5模板網!