Reputation: 7015
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.
Upvotes: 427
Views: 260874
Reputation: 2819
If File -> Invalidate Caches / Restart doesn't help, click on the button in the image:
'Sync Project with Gradle Files'
Upvotes: 41
Reputation: 4511
First of all you should update your Android Studio as stated here: 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.
Upvotes: 239
Reputation: 15759
.idea
directory located inside the project folder.iml
filesUpvotes: 707
Reputation: 11
click File -> Invalidate Caches/ Restart doesn't help you anymore
Delete .iml , .idea files & folders from file explorer not inside android studio
Open android studio with different/another project
import project newly not from recent
build the project again
Upvotes: 1
Reputation: 149
Upvotes: 4
Reputation: 141
Try:
Go to File->Invalidate Caches / Restart.
Close android studio, Go to C:\Users\(Your UserName)\.AndroidStudio(version)\system and delete caches folder.
If till now nothing worked, then this step will definitely work...
Upvotes: 4
Reputation: 171
Invalidating caches/Restart didn't work for me, but simply deleting the caches folder in \Users\user.AndroidStudio(version)\system worked.
Upvotes: 11
Reputation: 316
I have the same issue. I was tried Invalidate Cache / Restart
& also sync project with Gradle Files
but still didn't work.
But worked by use the following steps:
upgrading gradle distribution version at gradle.wrapper.properties.
distributionUrl=https\://services.gradle.org/distributions/gradle-6.5-all.zip
And also Android Gradle Plugin at build.gradle project
classpath 'com.android.tools.build:gradle:4.1.2' //upgrade gradle plugin here
Then Invalidate Cache / Restart
That's all solved my problem. Hope you too
Upvotes: 1
Reputation: 3825
All above answer is correct but in my case There is no lib folder available in my app directory and I am trying to call below line in app gradle file
compile fileTree(include: ['*.jar'], dir: 'libs')
So make sure what ever dependency you declare in gradle file in available for app
Upvotes: 0
Reputation: 3686
.idea/modules.xml
You do not want to remove entire .idea directory, because it contains e.g. dictionaries and shelved changes.
Upvotes: 19
Reputation: 858
The above solution I've tried but didn't work for me.
.idea
folder from project directory.File -> Invalidate Caches / Restart
.gradle
folder from user profile directory of Windows 10 operating system. (i.e., C:\Users\YourUserName\.gradle)Try this solution if the above not working.
Upvotes: 5
Reputation: 815
I had the exact same error and it was so annoying to see the alert every time I stared Android Studio. I tried the solution mentioned above including invalidating cache, restart etc, nothing made it go away.
In my case, we had a module that was deleted from source and the reference also removed from settings.gradle
. Turns out, .idea/modules.xml
was still referencing that module.
All I needed to do was remove that line from <modules>
in .idea/modules.xml
and it made it all go away.
Upvotes: 2
Reputation: 287
You may resolve by below process:
In Android Studio, go to left panel, switch from Android
to Project
pane
Expand .idea
folder, you can see modules.xml
and open the file.
In the modules.xml
file, you might see like below:
<component name="...">
<modules>
<module fileurl="file://$PROJECT_DIR$/[check...].iml" filepath="$PROJECT_DIR$/[check...].iml" group="myProject" />
<module fileurl="file://$PROJECT_DIR$/app/[check...]-app.iml" filepath="$PROJECT_DIR$/app/[check...]-app.iml" group="[check...]/app" />
Check that match the module name correctly in module element
And then, sync the gradle file
Upvotes: 13
Reputation: 1783
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.
Upvotes: 18
Reputation: 830
In My Case
I have deleted
android -> .idea Folder
android -> appname.iml file
android -> app -> app.iml file
Open project in Android Studio and no need to File -> Invalidate Caches/Restart
You can do Invalidate Caches / Restart for your case.
Upvotes: 6
Reputation: 81
Delete *.iml file in your project and make invalidate the cache and restart
Upvotes: 0
Reputation: 2043
I know it's an 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.
Upvotes: 20
Reputation: 216
Upvotes: 2
Reputation: 81
Try the below,
Upvotes: 8
Reputation: 2547
Goto .idea/modules.xml
& delete the invalid/not existing path <module />
. Then File => Invalidate Caches / Restart.
Upvotes: 85
Reputation: 236
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
Upvotes: 0
Reputation: 6099
For windows users, this can also be caused by filesystem corruption.
If all steps above do not correct the error:
chkdsk /f
on the drive your app is stored.idea
folderUpvotes: 2
Reputation: 7220
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...
Upvotes: 3
Reputation: 3737
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
.
Upvotes: 1
Reputation: 9615
I had the same issue on androidStudio 3.2
and clonning the project worked for me
Upvotes: 1
Reputation: 753
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.
Upvotes: 4
Reputation: 45
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.
Upvotes: -1
Reputation: 28748
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.
Upvotes: 1
Reputation: 12564
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)
Upvotes: 9
Reputation: 902
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!.
Upvotes: 10