android studio error non greadle java modules code example

Example 1: capacitor-android. Unfortunately you can't have non-Gradle Java modules and Android-Gradle modules in one project

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

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

save .idea folder somewhere else (for backup)
remove .idea folder
start AndroidStudio
select project
[there may be an error, ignore that]
click File -> Invalidate Caches/ Restart
click button: Invalidate Caches/ Restart
resolved

Tags:

Java Example