googleads / googleads-consent-sdk-android

Consent SDK
https://developers.google.com/admob/android/eu-consent
Apache License 2.0
100 stars 82 forks source link

Fatal Exception: android.content.res.Resources$NotFoundException (Android 5 and 5.1 issue) #115

Open ArLabDev opened 3 years ago

ArLabDev commented 3 years ago

Exception reported on several devices. (resource ID may change: #0x2040002, #0x2040003, #0x3040002, #0x3040005) with 'com.google.android.ads.consent:consent-library:1.0.8'

Fatal Exception: android.content.res.Resources$NotFoundException
String resource ID #0x3040005
android.content.res.HwResources.getText (HwResources.java:1326)
com.google.ads.consent.ConsentForm$Builder.build (ConsentForm.java:210)

Here how ConsentForm is called:

            mConsentForm = new com.google.ads.consent.ConsentForm.Builder(mCurrentActivity, new URL(getResources().getString(R.string.privacy_link)) )
                .withListener(new com.google.ads.consent.ConsentFormListener()
                {
                    @Override
                    public void onConsentFormLoaded()
                    {
                        // Consent form has loaded successfully, now show it
                        mConsentForm.show();
                    }

                    @Override
                    public void onConsentFormOpened()
                    {
                        // Consent form was displayed.
                    }

                    @Override
                    public void onConsentFormClosed(
                        com.google.ads.consent.ConsentStatus consentStatus, Boolean userPrefersAdFree )
                    {
                        // [Omissis] Our code...

                        mConsentForm = null;
                    }

                    @Override
                    public void onConsentFormError( String errorDescription )
                    {
                        // Consent form error. Would be nice to have some proper logging
                        Log.e( TAG, "onConsentFormError: "+errorDescription );

                        // [Omissis] Our code...
                    }
                })
                .withPersonalizedAdsOption()
                .withNonPersonalizedAdsOption()
                .withAdFreeOption()
                .build();
            mConsentForm.load();