Coding⏱️ 2 min read📅 2026-05-30

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

IntelliJ error message for mixed Java and Android modules.

Quick Answer: Configure separate build configurations or use a custom Gradle script to resolve the issue.

To resolve the error 'Error: Unfortunately you can't have non-Gradle Java modules and > Android-Gradle modules in one project' in IntelliJ, follow these steps:

⚠️ Common Causes

  • IntelliJ is unable to resolve the conflict between Gradle and Maven modules in the same project.

🛠️ Step-by-Step Verified Fixes

Method 1: Consolidate Modules

  1. Step 1: Remove the Spring Maven module from the project.
  2. Step 2: Reconfigure the Android Gradle module to use a separate Maven configuration file (pom.xml).

Method 2: Use the 'Multi-Module' Project Structure

  1. Step 1: Create a new Maven project in IntelliJ.
  2. Step 2: Move the Android Gradle module to the new Maven project.
  3. Step 3: Configure the Maven project to include both the Android and Spring modules as sub-projects.

🎯 Final Words

By following these steps, you should be able to resolve the conflict and build both the Android Gradle module and Spring Maven module in your IntelliJ project.

Did this fix your problem?

If not, try searching for specific error codes.

🔍 Search Error Database

❓ Frequently Asked Questions