Okhttp 的 retrofit2 运行警告信息异常 您所在的位置:网站首页 警告提示模式 Okhttp 的 retrofit2 运行警告信息异常

Okhttp 的 retrofit2 运行警告信息异常

2023-03-15 06:28| 来源: 网络整理| 查看: 265

最近在使用一个 okhttp 的项目运行的时候得到下面的警告信息。

WARNING: An illegal reflective access operation has occurred WARNING: Illegal reflective access by retrofit2.Platform (file:/C:/Users/yhu/.m2/repository/com/squareup/retrofit2/retrofit/2.9.0/retrofit-2.9.0.jar) to constructor java.lang.invoke.MethodHandles$Lookup(java.lang.Class,int) WARNING: Please consider reporting this to the maintainers of retrofit2.Platform WARNING: Use --illegal-access=warn to enable warnings of further illegal reflective access operations WARNING: All illegal access operations will be denied in a future release

针对这个问题,已经有官方的说明, 说明的地址为:Illegal reflective access · Issue #3341 · square/retrofit · GitHub

解决办法

我们可以有下面的一些解决方案:

可以持续使用 Retrofit 2.8.x 或者更新的版本,或者你可以使用 JDK 17 的版本。如果你不想升级 JDK 版本的话,你可以继续使用 Retrofit 2.7 版本来避免这个问题。

https://www.ossez.com/t/okhttp-retrofit2/14340



【本文地址】

公司简介

联系我们

今日新闻

    推荐新闻

    专题文章
      CopyRight 2018-2019 实验室设备网 版权所有