-3

吨

当我尝试添加 gdpr 代码时,我得到了这个错误,我尝试了一些方法,但我仍然遇到同样的问题,如果有人能帮助我,我希望大家能帮助我,谢谢。

// TODO: Replace with your app's privacy policy URL.
        privacyUrl = new URL("https://www.your.com/privacyurl");
    } catch (MalformedURLException e) {
        e.printStackTrace();
        // Handle error.
    }
    ConsentForm form = new ConsentForm.Builder(context, privacyUrl)
            .withListener(new ConsentFormListener() {
                @Override
                public void onConsentFormLoaded() {
                    // Consent form loaded successfully.
                }

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

1 回答 1

0

将依赖项添加到模块的build.gradle

// Google AdMob, EU Cookie Consent
implementation ("com.google.android.ads.consent:consent-library:1.0.7") {
    // exclude group: "com.google.code.gson"
}

进口是:

import com.google.ads.consent.AdProvider;
import com.google.ads.consent.ConsentForm;
import com.google.ads.consent.ConsentFormListener;
import com.google.ads.consent.ConsentInfoUpdateListener;
import com.google.ads.consent.ConsentInformation;
import com.google.ads.consent.ConsentStatus;
import com.google.ads.consent.DebugGeography;
于 2019-11-12T03:01:52.237 回答