Error: Unfortunately you can't have non-Gradle Java modules and > Android-Gradle modules in one project
Solution 1
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
Answer from here
Solution 2
- Go to File -> Invalidate Caches/Restart.
- Close the project.
- Go to project folder and delete .idea folder.
- Delete YourProjectName.iml in project folder.
- Delete app.iml in app folder.
- Open Android studio -> open existing project, and then select your project.
- The Load Settings error and Unsupported modules detected error will be gone.
Solution 3
- Close the project
- Just delete the modules.xml in .idea folder.
- Open the project again.
Solution 4
The ultimate solution to this error:
SOLUTION 1
Step 1 Go to File -> Invalidate Caches/Restart.
Step 2 Close the project.
Step 3 Go to project folder and delete .idea folder.
Step 4 Delete YourProjectName.iml in project folder.
step 5 You will see a folder below graddle folder, Delete YourProjectName folder (it contains another YourProjectName.iml file).
Step 6 Open Android studio -> open existing project, and then select your project.
**
SOLUTION 2
**
Step 1: Open the Corrupted Project (The one showing error).
Step 2: Open system.gradle file.
step 3: add this line of code include ':app'
.
Step 4: click on the sync, to sync the gradle file.
Solution 5
In my case settings.gradle contained invalid configuration.
I changed:
include ':app' rootProject.name='<somthing else>'
To:
include ':app'
Error is gone. So maybe check your settings.gradle for potential errors. If this won't work try to remove cache and other tips.
Comments
-
kamokaze about 2 years
I have an IntelliJ 14.1.2 Project consisting of two modules - one is an Android Gradle based module and the other is a Spring Java-based module with Maven.
gps-trackman.v1 is my root project and I've not configured any outputs or facets for this project. The app is my android gradle module and I've configured Android and Android-Gradle Facet for this project and gps-trackman isn't my Spring Maven Project. I want to be able to build everything all together. Is it possible?
I now get this error message in my IntelliJ Eventlog
Unsupported Modules Detected: Compilation is not supported for following modules: gps-trackman, gps-trackman.v1, app. Unfortunately you can't have non-Gradle Java modules and Android-Gradle modules in one project.
The project 'gps-trackman.v1' is not a Gradle-based
Is this error just due to a misconfiguration of my project or is it really not possible to have a maven module and a Gradle module in one project?
Do I have to configure any Facets for the root project? Alternatively, do I have to convert my maven to gradle?
-
kamokaze over 7 yearsI don't use android studio . this is not my case !
-
JC Carrillo almost 6 yearsWas getting "Unsupported Modules Detected: Compilation is not supported for following modules: mobile. Unfortunately you can't have non-Gradle Java modules and Android-Gradle modules in one project" - this helped me. Thanks!
-
schemacs over 5 years
File -> Settings (= STRG+ALT+S) -> Plugins -> uncheck "Android Support"
JetBrains Help Page -
IulianT over 4 yearsworked for me with just the deletion of .idea dir, on astudio 3.5
-
Stealth Rabbi over 4 yearsDoes this work on only specific versions of Android Studio ?
-
user_MGU over 4 yearsThank. It helped me. And the solution is pretty! :) But with: Sync Project with Gradle Files
-
MohanRaj S over 4 yearsWhat are file will configure in .gitignore, can you please give suggestions for the new project.
-
djdance over 4 yearsIn my case I had no such a plugin, but had "Markdown plugin" marked as red incompatible, I uninstalled it and solved the problem after AS restart.
-
Stuart Schechter over 4 years1.a After selecting "Invalidate Caches/Restart" a dialog appears. Make sure to choose the "invalidate" option only and close Android studio manually. If you choose "invalidate + restart" Android studio will restart before you can complete steps 3-5.
-
Redar about 4 yearsdeleting .idea folder and .iml file helped.
-
3c71 about 4 yearsIt worked for me. I had this error on a gradle module that was later removed but error kept being reported no matter what. Removing the module from modules.xml worked while everything else didn't.
-
tir38 about 4 yearsBe careful deleting .idea directory. There is a lot of stuff in that directory that will get lost and not auto-generated when you relaunch A/S. Specifically
codeStyles
anddictionaries
-
JCarlosR about 4 yearsIt works for AS 3.6.3 too. I just closed the IDE, deleted the files and reopen. Didn't have to close the project nor import (I believe the IDE does it anyway).
-
Neo almost 4 years@tir38, I think all the files in .idea folder are auto-generated. No need to worry while deleting. Android Studio creates every file by itself.
-
Neo almost 4 years@MohanRajS, all the files which generates automatically must be ignored. For example- every iml file, .idea folder, .gradle folder, build folder, .classpath, .project , .log, .apk, .aab etc.
-
Rahul Tiwari almost 4 yearsmore precisely: deleting
modules.xml
from.idea
directory works. stackoverflow.com/a/61813520/1529129 -
Afilu almost 4 yearsWorked for me with android studio 4.0
-
Suresh Maidaragi almost 4 yearsPlease try to add solution instead redirecting to another websites
-
Nimral almost 4 yearsWorked for me too, needed to rebuild the project before it worked.
-
hushed_voice over 3 yearsDamn..worked for me..
cmd+shitf+.
to see hidden folders(.idea) in mac btw -
sceee over 3 yearsReceived this after upgrading
firebase_crashlytics
package in a flutter project (Upgrade from Fabric-based to FB-based: firebase.googleblog.com/2020/06/…). This solution solved it. -
DavidUps over 2 yearsIt doesn't work on android artic fox, I think it's more related to Gradle but I don't find it...
-
Admin about 2 yearsAs it’s currently written, your answer is unclear. Please edit to add additional details that will help others understand how this addresses the question asked. You can find more information on how to write good answers in the help center.
-
Sadra about 2 yearsThis does not provide an answer to the question. Once you have sufficient reputation you will be able to comment on any post; instead, provide answers that don't require clarification from the asker. - From Review
-
mohammad reza sarsarabi about 2 yearsthis was the only solution that worked for me! of course after invalidate caches and restart.