Error: Unfortunately you can't have non-Gradle Java modules and > Android-Gradle modules in one project

前端 未结 25 2411
孤独总比滥情好
孤独总比滥情好 2020-12-12 10:29

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-track

相关标签:
25条回答
  • 2020-12-12 11:05

    Tried all above. Didn't work.

    Here's what worked. Go to the file called modules.xml

    Delete all the modules there. Clean and rebuild.

    0 讨论(0)
  • 2020-12-12 11:05

    You can simply downgrade your gradle dependency to fit your current android studio version.

    dependencies {
            classpath 'com.android.tools.build:gradle:3.5.2'
            ....
    }
    

    Worked for me.

    0 讨论(0)
  • 2020-12-12 11:06
    1. Go to File -> Invalidate Caches/Restart.
    2. Close the project.
    3. Go to project folder and delete .idea folder.
    4. Delete YourProjectName.iml in project folder.
    5. Delete app.iml in app folder.
    6. Open Android studio -> open existing project, and then select your project.
    7. The Load Settings error and Unsupported modules detected error will be gone.
    0 讨论(0)
  • 2020-12-12 11:07

    Had same issue with Android Studio 3.3 Canary 13.

    I was able to solve it by following these steps:

    • Go to the module settings and remove your module from the list
    • Edit settings.gradle and remove your module from there also
    • Physically move the module directory out of the project (to your desktop for instance)
    • Then in the module settings again add a module and select as type 'Import Gradle Project' in which you select the module folder you have moved to your desktop (or anywhere else)

    When you complete these steps the module will be copied into your project again, AS will start syncing Gradle again and that succeeds without errors :-) Check your GIT status and you will see as soon as you add your module directory to GIT again that nothing has changed to your working directory. So it's purely an issue with AS that gets somehow out-of-sync...

    Based my solution on this comment: https://issuetracker.google.com/issues/37008041#comment3

    0 讨论(0)
  • 2020-12-12 11:08

    Follow these steps :

    1-Command+Shift+F

    2-Type : modules.xml

    3-Open file

    4-Remove those you get error for (the module when you get error once building project)

    Good luck :)

    0 讨论(0)
  • 2020-12-12 11:10

    the error explain all things, the idea is confused between gradle and maven.

    try to create new project with two gradle modules, you can build spring application with gradle as maven.

    see this example from spring guides

    0 讨论(0)
提交回复
热议问题