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

huangapple go评论81阅读模式
英文:

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

问题

我正在尝试在Android Studio中运行我的旧Android项目,但我已经更新了我的Gradle版本,然而,我遇到了以下错误:

**任务“:processDebugManifest”的执行失败。

无法使字段 private final java.lang.String java.io.File.path 可访问:模块 java.base 未“opens java.io”到未命名模块 @13d72a22**

Gradle版本:7.2 JDK版本:17

我尝试了Gradle属性值:

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

英文:

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

答案1

得分: 4

将以下内容翻译为中文:

解决方案:
在您的 gradle.properties 文件中添加以下行:

org.gradle.jvmargs=-Xmx1536M --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:
Add the below line in your gradle.properties

org.gradle.jvmargs=-Xmx1536M --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

答案2

得分: 1

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

检查 AGL 的兼容性。

查看 AGL 兼容性信息

英文:

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

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

答案3

得分: 0

以下是您要翻译的内容:

https://docs.gradle.org/current/userguide/compatibility.html#:~:text=A%20Java%20version%20between%208,be%20supported%20in%20Gradle%209.0.

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

检查与Gradle的Java兼容性,然后在项目结构中进行修改。

英文:

https://docs.gradle.org/current/userguide/compatibility.html#:~:text=A%20Java%20version%20between%208,be%20supported%20in%20Gradle%209.0.

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

Check Java Compatibility with Gradle & then modify it in Project structure

huangapple
  • 本文由 发表于 2023年6月9日 13:18:41
  • 转载请务必保留本文链接:https://go.coder-hub.com/76437404.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定