androidでEUのgdprのためのフォームを表示したい
android(java)でAdMobの広告を使ったアプリを作っています。
Consent SDKを使いEUユーザーに確認のフォームを表示したいのですが次のようなエラーが出てアプリは起動しますがフォームは表示されません。
どのようにすればフォームを表示することができますか?
発生している問題・エラーメッセージ
Logcat
1I/.example.adtes: Not late-enabling -Xcheck:jni (already on) 2W/.example.adtes: Unexpected CPU variant for X86 using defaults: x86 3V/FA: Deferring to Google Analytics for Firebase for event data collection. https://goo.gl/J1sWQy 4W/.example.adtes: Unsupported class loader 5I/DynamiteModule: Considering local module com.google.android.gms.ads.dynamite:0 and remote module com.google.android.gms.ads.dynamite:310 6I/DynamiteModule: Selected remote version of com.google.android.gms.ads.dynamite, version >= 310 7W/DynamiteModule: Dynamite loader version < 2, falling back to loadModule2 8W/.example.adtes: Unsupported class loader 9W/.example.adtes: Skipping duplicate class check due to unsupported classloader 10V/FA: Registered activity lifecycle callback 11I/FirebaseInitProvider: FirebaseApp initialization successful 12V/FA: onActivityCreated 13V/FA: Collection enabled 14V/FA: App package, google app id: com.example.adtest, 1:189935235105:android:a12a736c001ea5ecfe7360 15I/FA: App measurement is starting up, version: 18202 16I/FA: To enable debug logging run: adb shell setprop log.tag.FA VERBOSE 17I/FA: To enable faster debug mode event logging run:adb shell setprop debug.firebase.analytics.app com.example.adtest 18D/FA: Debug-level message logging enabled 19V/FA: Connecting to remote service 20V/FA: Detected application was in foreground 21W/.example.adtes: Accessing hidden method Landroid/view/View;->computeFitSystemWindows(Landroid/graphics/Rect;Landroid/graphics/Rect;)Z (light greylist, reflection) 22W/.example.adtes: Accessing hidden method Landroid/view/ViewGroup;->makeOptionalFitsSystemWindows()V (light greylist, reflection) 23V/FA: Session started, time: 10182399 24D/FA: Setting user property (FE): _sid, 1572262989 25V/FA: Connection attempt already in progress 26I/FA: Tag Manager is not found and thus will not be used 27D/FA: Logging event (FE): session_start(_s), Bundle[{ga_event_origin(_o)=auto, ga_session_id(_sid)=1572262989}] 28V/FA: Connection attempt already in progress 29V/FA: Connection attempt already in progress 30I/WebViewFactory: Loading com.android.chrome version 69.0.3497.100 (code 349710017) 31D/NetworkSecurityConfig: Using Network Security Config from resource network_security_config debugBuild: true 32I/.example.adtes: The ClassLoaderContext is a special shared library. 33I/cr_LibraryLoader: Time to load native libraries: 6 ms (timestamps 2832-2838) 34I/chromium: [INFO:library_loader_hooks.cc(36)] Chromium logging enabled: level = 0, default verbosity = 0 35I/cr_LibraryLoader: Expected native library version number "69.0.3497.100", actual native library version number "69.0.3497.100" 36E/cr_VariationsUtils: Failed reading seed file "/data/user/0/com.example.adtest/app_webview/variations_seed": /data/user/0/com.example.adtest/app_webview/variations_seed (No such file or directory) 37W/cr_ChildProcLH: Create a new ChildConnectionAllocator with package name = com.android.chrome, sandboxed = true 38I/cr_BrowserStartup: Initializing chromium process, singleProcess=false 39W/cr_media: Requires BLUETOOTH permission 40E/Ads: Google Mobile Ads SDK initialization functionality unavailable for this session. Ad requests can be made at any time. 41I/ConsentInformation: This request is sent from a test device. 42I/ConsentInformation: This request is sent from a test device. 43V/FA: Activity resumed, time: 10183065 44D/OpenGLRenderer: Skia GL Pipeline 45I/ConfigStore: android::hardware::configstore::V1_0::ISurfaceFlingerConfigs::hasWideColorDisplay retrieved: 0 46I/ConfigStore: android::hardware::configstore::V1_0::ISurfaceFlingerConfigs::hasHDRDisplay retrieved: 0 47D/FA: Logging event (FE): screen_view(_vs), Bundle[{ga_event_origin(_o)=auto, ga_screen_class(_sc)=MainActivity, ga_screen_id(_si)=-9006671786484008695}] 48D/EGL_emulation: eglCreateContext: 0xebdfa420: maj 3 min 0 rcv 3 49D/EGL_emulation: eglMakeCurrent: 0xebdfa420: ver 3 0 (tinfo 0xd7260210) 50V/FA: Connection attempt already in progress 51V/FA: Connection attempt already in progress 52W/VideoCapabilities: Unrecognized profile 4 for video/hevc 53I/OpenGLRenderer: Initialized EGL, version 1.4 54D/OpenGLRenderer: Swap behavior 1 55W/OpenGLRenderer: Failed to choose config with EGL_SWAP_BEHAVIOR_PRESERVED, retrying without... 56D/OpenGLRenderer: Swap behavior 0 57I/VideoCapabilities: Unsupported profile 4 for video/mp4v-es 58W/cr_MediaCodecUtil: HW encoder for video/avc is not available on this device. 59I/.example.adtes: Background concurrent copying GC freed 20489(1366KB) AllocSpace objects, 7(136KB) LOS objects, 49% free, 2MB/5MB, paused 525us total 195.847ms 60D/FA: Connected to remote service 61V/FA: Processing queued up service tasks: 6 62W/cr_CrashFileManager: /data/user/0/com.example.adtest/cache/WebView/Crash Reports does not exist or is not a directory 63D/forGDPR: -> onConsentFormErrorCould not parse Event FE preflight response. 64E/TAG: END THIS APP
該当のソースコード
プロジェクトレベルのGradle
Gradle
1buildscript { 2 repositories { 3 google() 4 jcenter() 5 } 6 dependencies { 7 classpath 'com.android.tools.build:gradle:3.5.1' 8 classpath 'com.google.gms:google-services:4.2.0' 9 10 // NOTE: Do not place your application dependencies here; they belong 11 // in the individual module build.gradle files 12 } 13} 14 15allprojects { 16 repositories { 17 google() 18 jcenter() 19 20 maven { 21 url "https://maven.google.com" 22 } 23 } 24} 25 26task clean(type: Delete) { 27 delete rootProject.buildDir 28}
アプリレベルのGradle
Gradle
1apply plugin: 'com.android.application' 2apply plugin: 'com.google.gms.google-services' 3 4android { 5 compileSdkVersion 29 6 buildToolsVersion "29.0.2" 7 defaultConfig { 8 applicationId "com.example.adtest" 9 minSdkVersion 16 10 targetSdkVersion 29 11 versionCode 1 12 versionName "1.0" 13 testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner" 14 } 15 buildTypes { 16 release { 17 minifyEnabled false 18 proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro' 19 } 20 } 21} 22 23dependencies { 24 implementation fileTree(dir: 'libs', include: ['*.jar']) 25 implementation 'androidx.appcompat:appcompat:1.0.2' 26 implementation 'androidx.constraintlayout:constraintlayout:1.1.3' 27 implementation 'com.google.firebase:firebase-ads:17.0.0' 28 testImplementation 'junit:junit:4.12' 29 androidTestImplementation 'androidx.test.ext:junit:1.1.0' 30 androidTestImplementation 'androidx.test.espresso:espresso-core:3.1.1' 31 implementation 'com.google.android.ads.consent:consent-library:1.0.7' 32 implementation 'com.google.firebase:firebase-analytics:17.2.0' 33 apply plugin: 'com.google.gms.google-services' 34 implementation 'com.google.android.gms:play-services-ads:18.2.0' 35} 36
https://qiita.com/tokisuzume/items/de41f901ce772c7880c4にendAppを追加してエラーだけ吐くように追加しました。
またパブリッシャーIDなどはしっかりと自分のものに変えてあります。
MainActivity
1 public void endApp(){ 2 Log.e("TAG","END THIS APP"); 3 }
PersonalizedAdManager.javaはhttps://github.com/tokisuzume/PersonalizedAdManager/blob/master/src/PersonalizedAdManager.javaにある内容をそのまま移してあります。
試したこと
https://developers.google.com/admob/android/eu-consent#consent_sdkにしたがってコードの書き直し
エミュレータとAndroidStudioの再インストール及びアップデート
SDKのバージョンによって不具合があると言う書き込みを見つけたのでバージョンを総当りで変更
補足情報
AndroidStudio 3.5.1
バッドをするには、ログインかつ
こちらの条件を満たす必要があります。
2019/12/13 10:20 編集
2019/12/13 10:26
2019/12/13 10:29