Android studio Error “Unsupported Modules Detected: Compilation is not supported for following modules”

给你一囗甜甜゛ 提交于 2019-11-26 23:54:02

问题


I am using Android studio 1.0.1. I have a java module referred by other modules in my project. I have checked it out from SVN But now every

Unsupported Modules Detected: Compilation is not supported for following modules: . Unfortunately you can't have non-Gradle Java modules and Android-Gradle modules in one project.

After getting this error AS stop compilation of this module so that I am not able to compile/run my project any more.


回答1:


First of all you should update to Android Studio 1.2 Source: https://code.google.com/p/android/issues/detail?id=77983

Then you should go to File -> Invalidate Caches / Restart -> Invalidate Caches & Restart.

Then try to build the application again.




回答2:


1- close the project

2- close Android Studio IDE

3- delete the .idea directory

4- delete all .iml files

5- open Android Studio IDE and import the project




回答3:


Invalidate Caches and Restart did not work for me. I also updated all my Android Studio files with no success.

The solution I found was importing the android folder by clicking "Import project (Eclipse ADT, Gradle, etc.)" rather than clicking "Open an existing Android Studio Project" or dragging the folder onto the app icon.

Apparently the problem is caused because a module in the project has an *.iml file that does not contain external.system.id="GRADLE".

When you import the project (as opposed to opening it), the iml files are completely re-written, thus removing the error.

I found the info here: https://issuetracker.google.com/issues/37008041




回答4:


Try this if it helps File -> Invalidate Caches / Restart.

If it still doesn't help click on the button in the image. 'Sync Project with Gradle Files'




回答5:


Goto .idea/modules.xml & delete the invalid/not existing path <module />. Then File => Invalidate Caches / Restart.




回答6:


i know it's old question. but i faced this problem after updating to Android Studio 3.0 . i solved it by deleting app.iml file inside my app module and then Invalidate Caches / Restart.




回答7:


If the above doesn't help you - check your module .iml file and see if it contains any errors. (for the app module it will be app.iml).




回答8:


I solved a similar problem by closing the project, then re-importing the project (not opening, but re-importing as an eclipse or other project)




回答9:


Close the Android Studio and Move ".idea" Folder and paste it outside Project root folder( For Back up if you need).

Open the Android studio. On Opening the project it"ll ask add module (app) to your project. You can ignore the same.

It set set default build variant to be "debug". You can see build variant tab on left corner or hover on "Monitor" Symbol on left bottom

Note: No need to change your .iml file of your project.tom to get build variant option and "Invalidate Cache and Restart" will also not work rather it will clear your history files too!.




回答10:


You should import the the project

https://issuetracker.google.com/issues/37008041

This error shows up when there is a module in your project whose .iml file does not contain: external.system.id="GRADLE" Can you please check your .iml files? Also, instead of opening the project, import it, that will completely rewrite your .iml files and you won't see that error again.




回答11:


For windows users, this can also be caused by filesystem corruption.

If all steps above do not correct the error:

  • Close Android Studio
  • Open Command Prompt as Administrator
  • Run a chkdsk /f on the drive your app is stored
  • Delete .idea folder
  • Restart Android Studio



回答12:


You can update new version of Android studio then go to invalidate catches/restart.Click sync button build application.




回答13:


I had the same issue on androidStudio 3.2 and clonning the project worked for me




回答14:


Step 1 : Delete .iml file

Step 2 : Check if your Project Directory Contain any white spaces if so then Rename your project directory leaving space

ex:

Before : My Project

After rename : MyProject

and open Android Studio...




回答15:


Invalidating caches/Restart didn't worked for me. But simply deleting the caches folder in \Users\user.AndroidStudio(version)\system worked like a charm




回答16:


In my case I cloned a git-project where both Java and Kotlin included. Then checked another branch and pressed "Sync Project with Gradle Files". Android Studio 3.0.1.




回答17:


Check in build.gradle in app you have good compile link .I have mistake with this line compile 'com.android.support:support-annotations:x.x.x' delete and work.




回答18:


In my case it is because the root project name have a space. So instead of naming it as sample project, it should be sample-project or sample_project.




回答19:


rename project directory fix error for me, android studio 3.4.2




回答20:


I have encountered this problem.

I'm using buildSrc in my project.

I think the problem is with buildSrc. To solve the problem;

1- Kotlin and Android Stuido version updated (Kotlin version is 1.3.21, Android Studio version is 3.4)

2- Clean cache and restart android studio

But the problem is not solved.

As a last resort, I deleted the project file and clone it over git and the problem is solved




回答21:


Try the below,

  1. Close android studio
  2. Then delete .iml , .idea files
  3. Open again the android studio
  4. Sync with Gradle.



回答22:


  1. Close project
  2. Close Android Studio
  3. Copy Project to another directory
  4. Open Android Studio
  5. Import Project from that new directory.


来源:https://stackoverflow.com/questions/28668252/android-studio-error-unsupported-modules-detected-compilation-is-not-supported

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!