How To Fix The ”module Java.base Does Not “opens” To Unnamed Module ” Error In Android Studio?

To fix the "module java.base does not ‘opens’ to unnamed module" error in Android Studio, you can try the following steps:

  1. Update Gradle version: In your project’s build.gradle file, make sure you are using the latest Gradle version. You can specify the Gradle version in the dependencies block of the buildscript section.


    buildscript {
        dependencies {
            classpath ''
  2. Enable Java 11 compatibility: Add the following configuration to your module-level build.gradle file to enable Java 11 compatibility.

    android {
        compileOptions {
            sourceCompatibility JavaVersion.VERSION_11
            targetCompatibility JavaVersion.VERSION_11
  3. Clean and rebuild your project: After making the above changes, try cleaning and rebuilding your project.

    Click on "Build" in the menu bar, then select "Clean Project." Once the clean process is completed, select "Rebuild Project."

If the above steps don’t work, you can also try the following additional options:

  1. Invalidate caches and restart: Go to "File" in the menu bar, select "Invalidate Caches / Restart," and click on "Invalidate and Restart." This can sometimes resolve various build issues.

  2. Check for conflicting dependencies: Review your project’s dependency tree and make sure there are no conflicting dependencies causing the error. You can use the command ./gradlew app:dependencies in the terminal to see the dependencies of your app module.

    If any conflicting dependencies are found, you can try excluding them or updating them to compatible versions.

These steps should help resolve the "module java.base does not ‘opens’ to unnamed module" error in Android Studio.

About the Author Rex

I'm a passionate tech blogger with an insatiable love for programming! From my early days tinkering with code, I've delved into web dev, mobile apps, and AI. Sharing insights and tutorials with the world is my joy, connecting me to a global community of like-minded tech enthusiasts. Python holds a special place in my heart, but I embrace all challenges. Constantly learning, I attend tech conferences, contribute to open-source projects, and engage in code review sessions. My ultimate goal is to inspire the next generation of developers and contribute positively to the ever-evolving tech landscape. Let's code together!