Okhttp 的 retrofit2 运行警告信息异常

最近在使用一个 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

解决办法

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

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

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

posted @   huyuchengus  阅读(80)  评论(0编辑  收藏  举报
相关博文:
阅读排行:
· 无需6万激活码!GitHub神秘组织3小时极速复刻Manus,手把手教你使用OpenManus搭建本
· C#/.NET/.NET Core优秀项目和框架2025年2月简报
· Manus爆火,是硬核还是营销?
· 终于写完轮子一部分:tcp代理 了,记录一下
· 【杭电多校比赛记录】2025“钉耙编程”中国大学生算法设计春季联赛(1)
历史上的今天:
2021-03-11 Python yaml 使用的包
2021-03-11 Python 通过命令行安装包的时候 pip 提示错误
2021-03-11 Python 注释
2020-03-11 Ubuntu 如何查看安装的 JDK
2020-03-11 .class 怎么在 IDE 中查看源代码
点击右上角即可分享
微信分享提示