首页 > 解决方案 > 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)

标签: androidadmob

解决方案


推荐阅读