问题描述
我有WhoIAmResponse
和ProfileResponse
,但如果我尝试从ProfileResponse
获得任何价值,我会得到kotlin NPE。我在Logcat中进行调试的尝试表明,配置文件响应已被r8混淆(但在proguard-rules中对此规则有规定)
Timber.i(whoIAmResponseBody.result.toString())
Timber.i(whoIAmResponseBody.result.profile.toString())
if (whoIAmResponseBody.result.profile == null)
Timber.e("profile NULL")
else {
Timber.i("profile NOT null")
Timber.e(whoIAmResponseBody.result.profile?.name
?: "username NULL") //here i get NPE (and anywhere below if i try to access profile values)
}
data class WhoIAmResponse(
@Serializedname("id")
val userId: Long? = null,@Serializedname("suid")
val suId: Long? = null,@Serializedname("userid")
val userProfileId: Long? = null,@Serializedname("profile")
val profile: ProfileResponse? = null
) : BaseResponse()
data class ProfileResponse(
@Serializedname("id") val id: Long,@Serializedname("username") val username: String? = null
)
最新的保护规则https://pastebin.com/ZWQLjbSa
解决方法
暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!
如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。
小编邮箱:dio#foxmail.com (将#修改为@)