javaandroidandroid-studiobuild.gradlebuild-error

getting Error: How to make field private final java.lang.String java.io.File.path accessible while running my project


I am trying to run my old android project in android studio i have updated my gradle version however I am getting the following error:

**Execution failed for task ':processDebugManifest'.

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 @13d72a22**

Gradle version: 7.2 JDK version: 17

I have tried gradle property value:

org.gradle.jvmargs = -Xmx2048M -Dkotlin.daemon.jvm.options="-Xmx2048M" --add-exports=java.base/sun.nio.ch=ALL-UNNAMED --add-opens=java.base/java.lang=ALL-UNNAMED --add-opens=java.base/java.lang.reflect=ALL-UNNAMED --add-opens=java.base/java.io=ALL-UNNAMED --add-exports=jdk.unsupported/sun.misc=ALL-UNNAMED


Solution

  • enter image description here

    I just download JDK 11 and it's compatibale with AGP 7.2 and it's working

    check Compatibility for AGL

    https://developer.android.com/build/releases/past-releases/agp-7-2-0-release-notes