android - Admob Eu 同意 loadForm 导致崩溃
问题描述
我正在尝试出示 GDPR 表格以征得欧盟同意。当我通过内部应用程序测试对其进行测试时,它无法正常工作并导致崩溃。我对admob完全陌生。我去了新的隐私和消息传递选项,我有这个
公共类 HomeFragment 扩展 BaseFragment 实现 MyAdapter.NoteListener, PurchasesUpdatedListener {
private ConsentInformation consentInformation;
private ConsentForm consentForm;
public View onCreateView(@NonNull LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
View root = inflater.inflate(R.layout.fragment_home, container, false);
getConsentStatus();
return root;
}
public void getConsentStatus(){
ConsentRequestParameters params = new ConsentRequestParameters
.Builder()
.setTagForUnderAgeOfConsent(false)
.build();
consentInformation= UserMessagingPlatform.getConsentInformation(requireActivity());
consentInformation.requestConsentInfoUpdate(requireActivity(), params,
new ConsentInformation.OnConsentInfoUpdateSuccessListener() {
@Override
public void onConsentInfoUpdateSuccess() {
if(consentInformation.isConsentFormAvailable()){
try {
loadForm();
}catch (Exception e){debugToast(e.getMessage());}
}
}
}, new ConsentInformation.OnConsentInfoUpdateFailureListener() {
@Override
public void onConsentInfoUpdateFailure(@NonNull FormError formError) {
}
});
}
public void loadForm(){
UserMessagingPlatform.loadConsentForm(
requireActivity(),
new UserMessagingPlatform.OnConsentFormLoadSuccessListener() {
@Override
public void onConsentFormLoadSuccess(@NonNull ConsentForm consentForm) {
HomeFragment.this.consentForm=consentForm;
if(consentInformation.getConsentStatus()==ConsentInformation.ConsentStatus.REQUIRED){
consentForm.show(requireActivity(), new ConsentForm.OnConsentFormDismissedListener() {
@Override
public void onConsentFormDismissed(FormError formError) {
try {
loadForm();
}catch (Exception e){debugToast(e.getMessage());}
}
});
}
}
}, new UserMessagingPlatform.OnConsentFormLoadFailureListener() {
@Override
public void onConsentFormLoadFailure(@NonNull FormError formError) {
try {
loadForm();
}catch (Exception e){debugToast(e.getMessage());}
}
});
}
当我在内部测试轨道上上传并安装它时会发生崩溃。来自 firebase crashlatycs 的日志:
致命异常:java.lang.VerifyError 验证器拒绝类 com.navlab.recical.ui.home.HomeFragment:void com.navlab.recical.ui.home.HomeFragment.h1() 无法验证:void com.navlab.recical。 ui.home.HomeFragment.h1():[0x48] 无法从类型参考的对象访问实例字段 ccbbedz ccbbedhb:java.lang.Object(“com.navlab.recical.ui.home.HomeFragment”的声明出现在 /data /app/~~Hq2ou3cL8pLh7LMvC_brXA==/com.navlab.recical-OCMZc1E9XqZrpjokxu49Jg==/base.apk)
解决方案
推荐阅读
- spring-mvc - Thymleaf ,使用 jQuery 加载片段
- c# - 两个不同内容大小的 ScrollViewer 同步滚动
- vb.net - 实体框架选择与分组依据
- java - java.lang.NullPointerException:尝试调用虚拟方法'java.lang.String android.os.Bundle.getString(java.lang.String)'
- mysql - 在 MY-SQL 中将多个不存在的值一起插入。其中“NULL”应该是唯一的
- awk - 如何在双引号内使用 awk 变量?
- c - 这段代码是什么意思?fopen (pthis -> fname,w)
- hadoop - 如何使用 InputStream 读取 orcFile?
- apache-spark - 在 Spark 中安排任务
- javascript - 我收到 [Violation] 'setInterval' 处理程序在 chrome dev 中收到 N ms 警告,然后该应用程序被冻结