gpt4 book ai didi

android - 指定为非 null 的参数 pendingDynamicLinkData 为 null

转载 作者:行者123 更新时间:2023-12-04 23:41:55 24 4
gpt4 key购买 nike

private fun getReferralId() {
Firebase.dynamicLinks
.getDynamicLink(intent)
.addOnSuccessListener(this) { pendingDynamicLinkData ->
pendingDynamicLinkData?.link?.getQueryParameter(
DEEP_LINK_QUERY_PARAM_REFERRAL_ID
)?.let { refId ->
viewModel.saveReferralId(refId)
}
}
}
enter image description here

java.lang.NullPointerException: Parameter specified as non-null isnull: method kotlin.jvm.internal.Intrinsics.checkNotNullParameter,parameter pendingDynamicLinkDataat app.package.activity.MainActivity.getReferralId$lambda-2(UnknownSource:7)at app.package.activity.MainActivity.$r8$lambda$ANLS0uCuXrQe7RFQ5b0C-RFsBKE(UnknownSource:0)at app.package.activity.MainActivity$$ExternalSyntheticLambda3.onSuccess(UnknownSource:4)


版本:
implementation platform("com.google.firebase:firebase-bom:28.3.1")
implementation "com.google.firebase:firebase-dynamic-links-ktx"
这里有什么问题?
更新
当我更新 play-services-auth 库的版本时会发生这种情况
implementation "com.google.android.gms:play-services-auth:19.2.0"
implementation "com.google.android.gms:play-services-auth-api-phone:17.5.1"
到最新版本
implementation "com.google.android.gms:play-services-auth:20.0.0"
implementation "com.google.android.gms:play-services-auth-api-phone:18.0.0"
这有什么关系?

最佳答案

这是一个 bug in the library由于播放服务更新。要修复它,您应该明确声明 pendingDynamicLinkData可以为空。
像这样:

private fun getReferralId() {
Firebase.dynamicLinks
.getDynamicLink(intent)
.addOnSuccessListener(this) { pendingDynamicLinkData: PendingDynamicLinkData? ->
pendingDynamicLinkData?.link?.getQueryParameter(
DEEP_LINK_QUERY_PARAM_REFERRAL_ID
)?.let { refId ->
viewModel.saveReferralId(refId)
}
}
}

关于android - 指定为非 null 的参数 pendingDynamicLinkData 为 null,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/70377724/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com