缺少类:okhttp3.internal.http.UnrepeatableRequestBody

问题描述 投票:1回答:1

我将Android Studio更新为3.5,现在遇到了问题

minifyEnabled true

当我尝试使用okhttp3发送json数据时,主体为null。

我试图将这些规则添加到proguard中,但问题仍然存在。

-keep class cn.pedant.SweetAlert.** { *; }
-keep class okhttp3.** { *; }
-keep interface okhttp3.** { *; }

当minifyEnabled为true且仅更改版本时,我仅看到此警告。 :-|enter image description here

有什么想法吗?

目前,我将minifyEnabled设置为false。 -_-

android android-studio proguard okhttp
1个回答
0
投票

[UnrepeatableRequestBody在v3.14中已通过以下PR删除:https://github.com/square/okhttp/pull/4676

所以,我最终通过添加忽略了警告:

-dontwarn okhttp3.internal.http.UnrepeatableRequestBody

现在,为什么要警告我们该缺少的界面?好吧,我想这是因为okhttp3内部库之一依赖于UnrepeatableRequestBody而已被删除,这可能是一个临时警告,当内部库使用RequestBody#isOneShot新功能进行更新时,它将得到修复。

© www.soinside.com 2019 - 2024. All rights reserved.