How to fix the ''module java.base does not "opens java.io" to unnamed module '' error in Android Studio?
Background
- I started my first project in android studio to get familiar with Android programming.
- I am following this tutorial, in which
- I created a new project Empty Activity, without any change
- It is supposed to simulate a simple app that shows "Hello World" message
Problem Description But every time I try to run and build (I want to emulator as of now), I get the following error message.
Unable to make field private final java.lang.String java.io.File.path accessible:
Unable to make field private final java.lang.String java.io.File.path
accessible: module java.base does not "opens java.io" to unnamed module @42760a00
Here is my config set-up:
- Android Gradle plugin version: 4.2.1
- Gradle Version: 7.0.1 (changed to fix another issue I had while syncing the Gradle ("Gradle sync failed: Unsupported class file major version 60") and based discussion on this forum as quoted below)
Andrey Dernov commented 14 Apr 2021 00:18 Please use Gradle 7.0 or JDK less than 16 version for importgin and building the project (Settings (Preferences on macOS) | Build, Execution, Deployment | Build Tools | Gradle | Gradle JVM option).
- JDK: 16.0.1
Any suggestion or idea?