它在调试模式下工作正常,在ProGuard关闭的情况下在发布模式下工作正常,但在ProGuard打开的情况下工作不正常,即使是空的。
下面是堆栈跟踪:
2021-09-07 23:42:19.556 32130-32130/com.myapp.packagename W/System.err: java.lang.ClassCastException: java.lang.Class cannot be cast to java.lang.reflect.ParameterizedType
2021-09-07 23:42:19.556 32130-32130/com.myapp.packagename W/System.err: at h9.d0.f(Unknown Source:46)
2021-09-07 23:42:19.556 32130-32130/com.myapp.packagename W/System.err: at h9.y1.b(Unknown Source:39)
2021-09-07 23:42:19.556 32130-32130/com.myapp.packagename W/System.err: at h9.x1.c(Unknown Source:202)
2021-09-07 23:42:19.556 32130-32130/com.myapp.packagename W/System.err: at h9.v1.invoke(Unknown Source:160)
2021-09-07 23:42:19.556 32130-32130/com.myapp.packagename W/System.err: at java.lang.reflect.Proxy.invoke(Proxy.java:1006)
2021-09-07 23:42:19.556 32130-32130/com.myapp.packagename W/System.err: at $Proxy1.signUp(Unknown Source)
2021-09-07 23:42:19.556 32130-32130/com.myapp.packagename W/System.err: at k4.d.l(Unknown Source:35)
2021-09-07 23:42:19.556 32130-32130/com.myapp.packagename W/System.err: at k4.d.p(Unknown Source:8)
2021-09-07 23:42:19.556 32130-32130/com.myapp.packagename W/System.err: at k4.d.s(Unknown Source:4)
2021-09-07 23:42:19.556 32130-32130/com.myapp.packagename W/System.err: at j8.k1.f(Unknown Source:61)
2021-09-07 23:42:19.556 32130-32130/com.myapp.packagename W/System.err: at j8.b.e(Unknown Source:212)
2021-09-07 23:42:19.556 32130-32130/com.myapp.packagename W/System.err: at r4.u1.l(Unknown Source:311)
2021-09-07 23:42:19.556 32130-32130/com.myapp.packagename W/System.err: at o7.a.n(Unknown Source:33)
2021-09-07 23:42:19.556 32130-32130/com.myapp.packagename W/System.err: at g8.a1.run(Unknown Source:106)
2021-09-07 23:42:19.556 32130-32130/com.myapp.packagename W/System.err: at g8.h1.d0(Unknown Source:69)
2021-09-07 23:42:19.556 32130-32130/com.myapp.packagename W/System.err: at g8.b1.e(Unknown Source:244)
2021-09-07 23:42:19.556 32130-32130/com.myapp.packagename W/System.err: at g8.b1.a(Unknown Source:161)
2021-09-07 23:42:19.556 32130-32130/com.myapp.packagename W/System.err: at g8.n.s(Unknown Source:397)
2021-09-07 23:42:19.556 32130-32130/com.myapp.packagename W/System.err: at g8.n.p(Unknown Source:513)
2021-09-07 23:42:19.556 32130-32130/com.myapp.packagename W/System.err: at i8.r0.M(Unknown Source:1079)
2021-09-07 23:42:19.556 32130-32130/com.myapp.packagename W/System.err: at i8.k.V(Unknown Source:546)
2021-09-07 23:42:19.556 32130-32130/com.myapp.packagename W/System.err: at i8.k.l(Unknown Source:630)
2021-09-07 23:42:19.557 32130-32130/com.myapp.packagename W/System.err: at j8.p.c(Unknown Source:51)
2021-09-07 23:42:19.557 32130-32130/com.myapp.packagename W/System.err: at j8.p.a(Unknown Source:1)
2021-09-07 23:42:19.557 32130-32130/com.myapp.packagename W/System.err: at j8.o.l(Unknown Source:11)
2021-09-07 23:42:19.557 32130-32130/com.myapp.packagename W/System.err: at o7.a.n(Unknown Source:33)
2021-09-07 23:42:19.557 32130-32130/com.myapp.packagename W/System.err: at g8.a1.run(Unknown Source:106)
2021-09-07 23:42:19.557 32130-32130/com.myapp.packagename W/System.err: at androidx.compose.ui.platform.q1.f0(Unknown Source:81)
2021-09-07 23:42:19.557 32130-32130/com.myapp.packagename W/System.err: at androidx.compose.ui.platform.q1.Z(Unknown Source:41)
2021-09-07 23:42:19.557 32130-32130/com.myapp.packagename W/System.err: at androidx.compose.ui.platform.p1.run(Unknown Source:57)
2021-09-07 23:42:19.557 32130-32130/com.myapp.packagename W/System.err: at android.os.Handler.handleCallback(Handler.java:900)
2021-09-07 23:42:19.557 32130-32130/com.myapp.packagename W/System.err: at android.os.Handler.dispatchMessage(Handler.java:103)
2021-09-07 23:42:19.557 32130-32130/com.myapp.packagename W/System.err: at android.os.Looper.loop(Looper.java:219)
2021-09-07 23:42:19.557 32130-32130/com.myapp.packagename W/System.err: at android.app.ActivityThread.main(ActivityThread.java:8668)
2021-09-07 23:42:19.557 32130-32130/com.myapp.packagename W/System.err: at java.lang.reflect.Method.invoke(Native Method)
2021-09-07 23:42:19.557 32130-32130/com.myapp.packagename W/System.err: at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:513)
2021-09-07 23:42:19.557 32130-32130/com.myapp.packagename W/System.err: at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1109)
我试过这些ProGuard配置,但没有一个工作。
here
这里
2条答案
按热度按时间wz3gfoph1#
不知何故,这个
proguard-rules.pro
工作。导致
ClassCastException
的原因,根据我的推断,是缺乏对Moshi
的泛型类型的支持。这是我高度挂起的数据类是原因:8fsztsew2#
对我来说,我只有Retrofit,它通过将这些行添加到
proguard-rules.pro
中解决了我的问题在我的例子中,我包括了每个Kotlin类,因为我在这个包中也使用了超时,Continuation也在这个包中,它是进行转换的,所以,以防万一,我把它都加了进去