-
-
Notifications
You must be signed in to change notification settings - Fork 460
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
release 包混淆后,请求接口提示 Missing type parameter #396
Comments
经过一番筛查,发现是打包时,开启混淆优化导致的,开启后,
以上两个方案,都会关闭混淆优化,google官方的建议是使用第二种关闭混淆优化。 至于为啥开启优化后,获取泛型类型为啥会失败,我在
简单翻译下,就是 在下个版本中,会使用 |
补充下必现方式 1、定义一个顶级函数,返回泛型具体类型 //TypeToken是Gson库里的类
public inline fun <reified T> type() = object : TypeToken<T>() {}.type 2、在伴生对象中调用 object TypeUtil {
fun typeOf() {
val type = type<List<String>>()
}
} 3、在任意地方调用
最后打包时,开启混淆优化,打包后,安装测试即可 |
项目接口、
Parser
相关配置都使用 Kotlin 开发gradle 配置文件中,开启混淆后,访问任何接口都会提示
Missing type parameter
。关闭混淆正常。日志可以看到。解析器中没有泛型


开启后,没有泛型的
关闭混淆后,带有泛型的
The text was updated successfully, but these errors were encountered: