mapbox / mapbox/mapbox-java

Mapbox-java incompatible with gson 2.13.0 and up - call to internal GSON classes that were renamed

未关闭
#1,614 2 条评论 1 个 reaction 已指派 0 人 在 GitHub 查看

还没有人认领这个 Issue。

主要语言
Java
星标
438
派生
117
PR 合并指标
30 天内没有已合并 PR

描述

Attempted upgrading GSON (for internal app use and third-party integration requiring a newer version), but encountered issues with mapbox-java. R8 began reporting missing classes due to the following reference:

https://github.com/mapbox/mapbox-java/blob/977651247bcd5dd642de1dd5fd3093d00152099b/services-geocoding/src/main/java/com/mapbox/api/geocoding/v5/SingleElementSafeListTypeAdapter.java#L6

The root cause is the renaming of internal classes in GSON version 2.13.0:

The internal classes $Gson$Types and $Gson$Preconditions have been renamed to remove the $ characters. Since these are internal classes (as signaled not only by the package name but by the $ characters), client code should not be affected. If your code was depending on these classes then we suggest making a copy of the class (subject to the license) rather than depending on the new names.

r8 error:

ERROR: Missing classes detected while running R8. Please add the missing classes or apply additional keep rules that are generated in REDACTED/missing_rules.txt.
ERROR: R8: Missing class com.google.gson.internal.$Gson$Types (referenced from: com.google.gson.TypeAdapter com.mapbox.api.geocoding.v5.SingleElementSafeListTypeAdapter$1.create(com.google.gson.Gson, com.google.gson.reflect.TypeToken))

贡献指南

打开贡献指南

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

调研方向

从 services-geocoding/src/main/java/com/mapbox/api/geocoding/v5/SingleElementSafeListTypeAdapter.java 中被引用的 import 开始,并将其中对 GSON 的使用与 GSON 2.13.0 的发行说明进行比较。使用 GSON 2.13.0 或更高版本重现 R8 缺少类的错误,然后验证 geocoding 服务能够在没有该错误的情况下完成构建。

由索引模型根据 Issue 内容生成。

评估

技术栈
java
领域
mobile-dev
Issue 类型
缺陷
难度
2/5
预计耗时
1-3 小时
活跃度
停滞
描述清晰度
描述清楚
新手友好度
48/100

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。