Xamarin.Android で AdMob の広告を表示させようと思ったら、以下のような大量のスタックトレースが出て異常終了してしまいました。
この問題の解決方法は単純で、Xamarin.GooglePlayServices.Ads のバージョンを、60.1142.1 から 70.1501.0-preview2 にバージョンアップすることで問題解消しました。
慣れてないとハマると思うので、メモとして残しておきます。
Android.Views.InflateException: Binary XML file line #1: Binary XML file line #1: Error inflating class com.google.android.gms.ads.AdView ---> Android.Views.InflateException: Binary XML file line #1: Error inflating class com.google.android.gms.ads.AdView ---> Java.Lang.Reflect.InvocationTargetException: ---> Java.Lang.NoClassDefFoundError: Failed resolution of: Lcom/google/android/gms/R$styleable; ---> Java.Lang.ClassNotFoundException: Didn't find class "com.google.android.gms.R$styleable" on path: DexPathList[[zip file "/data/app/com.companyname.Xamarin_Android_AdMob-Vo0ea06lDhoddjE6C9rhCQ==/base.apk"],nativeLibraryDirectories=[/data/app/com.companyname.Xamarin_Android_AdMob-Vo0ea06lDhoddjE6C9rhCQ==/lib/arm64, /system/fake-libs64, /data/app/com.companyname.Xamarin_Android_AdMob-Vo0ea06lDhoddjE6C9rhCQ==/base.apk!/lib/arm64-v8a, /system/lib64, /system/vendor/lib64]] at java.lang.ClassNotFoundException: Didn't find class "com.google.android.gms.R$styleable" on path: DexPathList[[zip file "/data/app/com.companyname.Xamarin_Android_AdMob-Vo0ea06lDhoddjE6C9rhCQ==/base.apk"],nativeLibraryDirectories=[/data/app/com.companyname.Xamarin_Android_AdMob-Vo0ea06lDhoddjE6C9rhCQ==/lib/arm64, /system/fake-libs64, /data/app/com.companyname.Xamarin_Android_AdMob-Vo0ea06lDhoddjE6C9rhCQ==/base.apk!/lib/arm64-v8a, /system/lib64, /system/vendor/lib64]] at at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:93) at at java.lang.ClassLoader.loadClass(ClassLoader.java:379) at at java.lang.ClassLoader.loadClass(ClassLoader.java:312) at at com.google.android.gms.internal.zzix.<init>(Unknown Source:9) at at com.google.android.gms.internal.zzlb.<init>(Unknown Source:49) at at com.google.android.gms.internal.zzlb.<init>(Unknown Source:7) at at com.google.android.gms.internal.zzlb.<init>(Unknown Source:7) at at com.google.android.gms.ads.BaseAdView.<init>(Unknown Source:6) at at com.google.android.gms.ads.AdView.<init>(Unknown Source:1) at at java.lang.reflect.Constructor.newInstance0(Native Method) at at java.lang.reflect.Constructor.newInstance(Constructor.java:334) at at android.view.LayoutInflater.createView(LayoutInflater.java:647) at at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:790) at at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:730) at at android.view.LayoutInflater.rInflate(LayoutInflater.java:863) at at android.view.LayoutInflater.rInflateChildren(LayoutInflater.java:824) at at android.view.LayoutInflater.inflate(LayoutInflater.java:515) at at android.view.LayoutInflater.inflate(LayoutInflater.java:423) at at android.view.LayoutInflater.inflate(LayoutInflater.java:374) at at com.android.internal.policy.PhoneWindow.setContentView(PhoneWindow.java:418) at at android.app.Activity.setContentView(Activity.java:2654) at at md590b51b04120f98b286fdabac728c8b6d.MainActivity.n_onCreate(Native Method) at at md590b51b04120f98b286fdabac728c8b6d.MainActivity.onCreate(MainActivity.java:29) at at android.app.Activity.performCreate(Activity.java:6975) at at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1214) at at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2775) at at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2897) at at android.app.ActivityThread.-wrap11(Unknown Source:0) at at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1598) at at android.os.Handler.dispatchMessage(Handler.java:105) at at android.os.Looper.loop(Looper.java:251) at at android.app.ActivityThread.main(ActivityThread.java:6572) at at java.lang.reflect.Method.invoke(Native Method) at at com.android.internal.os.Zygote$MethodAndArgsCaller.run(Zygote.java:240) at at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:767) --- End of inner exception stack trace --- at java.lang.NoClassDefFoundError: Failed resolution of: Lcom/google/android/gms/R$styleable; at at com.google.android.gms.internal.zzix.<init>(Unknown Source:9) at at com.google.android.gms.internal.zzlb.<init>(Unknown Source:49) at at com.google.android.gms.internal.zzlb.<init>(Unknown Source:7) at at com.google.android.gms.internal.zzlb.<init>(Unknown Source:7) at at com.google.android.gms.ads.BaseAdView.<init>(Unknown Source:6) at at com.google.android.gms.ads.AdView.<init>(Unknown Source:1) at at java.lang.reflect.Constructor.newInstance0(Native Method) at at java.lang.reflect.Constructor.newInstance(Constructor.java:334) at at android.view.LayoutInflater.createView(LayoutInflater.java:647) at at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:790) at at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:730) at at android.view.LayoutInflater.rInflate(LayoutInflater.java:863) at at android.view.LayoutInflater.rInflateChildren(LayoutInflater.java:824) at at android.view.LayoutInflater.inflate(LayoutInflater.java:515) at at android.view.LayoutInflater.inflate(LayoutInflater.java:423) at at android.view.LayoutInflater.inflate(LayoutInflater.java:374) at at com.android.internal.policy.PhoneWindow.setContentView(PhoneWindow.java:418) at at android.app.Activity.setContentView(Activity.java:2654) at at md590b51b04120f98b286fdabac728c8b6d.MainActivity.n_onCreate(Native Method) at at md590b51b04120f98b286fdabac728c8b6d.MainActivity.onCreate(MainActivity.java:29) at at android.app.Activity.performCreate(Activity.java:6975) at at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1214) at at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2775) at at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2897) at at android.app.ActivityThread.-wrap11(Unknown Source:0) at at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1598) at at android.os.Handler.dispatchMessage(Handler.java:105) at at android.os.Looper.loop(Looper.java:251) at at android.app.ActivityThread.main(ActivityThread.java:6572) at at java.lang.reflect.Method.invoke(Native Method) at at com.android.internal.os.Zygote$MethodAndArgsCaller.run(Zygote.java:240) at at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:767) at Caused by: java.lang.ClassNotFoundException: Didn't find class "com.google.android.gms.R$styleable" on path: DexPathList[[zip file "/data/app/com.companyname.Xamarin_Android_AdMob-Vo0ea06lDhoddjE6C9rhCQ==/base.apk"],nativeLibraryDirectories=[/data/app/com.companyname.Xamarin_Android_AdMob-Vo0ea06lDhoddjE6C9rhCQ==/lib/arm64, /system/fake-libs64, /data/app/com.companyname.Xamarin_Android_AdMob-Vo0ea06lDhoddjE6C9rhCQ==/base.apk!/lib/arm64-v8a, /system/lib64, /system/vendor/lib64]] at at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:93) at at java.lang.ClassLoader.loadClass(ClassLoader.java:379) at at java.lang.ClassLoader.loadClass(ClassLoader.java:312) at ... 32 more --- End of inner exception stack trace --- at java.lang.reflect.InvocationTargetException at at java.lang.reflect.Constructor.newInstance0(Native Method) at at java.lang.reflect.Constructor.newInstance(Constructor.java:334) at at android.view.LayoutInflater.createView(LayoutInflater.java:647) at at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:790) at at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:730) at at android.view.LayoutInflater.rInflate(LayoutInflater.java:863) at at android.view.LayoutInflater.rInflateChildren(LayoutInflater.java:824) at at android.view.LayoutInflater.inflate(LayoutInflater.java:515) at at android.view.LayoutInflater.inflate(LayoutInflater.java:423) at at android.view.LayoutInflater.inflate(LayoutInflater.java:374) at at com.android.internal.policy.PhoneWindow.setContentView(PhoneWindow.java:418) at at android.app.Activity.setContentView(Activity.java:2654) at at md590b51b04120f98b286fdabac728c8b6d.MainActivity.n_onCreate(Native Method) at at md590b51b04120f98b286fdabac728c8b6d.MainActivity.onCreate(MainActivity.java:29) at at android.app.Activity.performCreate(Activity.java:6975) at at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1214) at at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2775) at at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2897) at at android.app.ActivityThread.-wrap11(Unknown Source:0) at at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1598) at at android.os.Handler.dispatchMessage(Handler.java:105) at at android.os.Looper.loop(Looper.java:251) at at android.app.ActivityThread.main(ActivityThread.java:6572) at at java.lang.reflect.Method.invoke(Native Method) at at com.android.internal.os.Zygote$MethodAndArgsCaller.run(Zygote.java:240) at at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:767) at Caused by: java.lang.NoClassDefFoundError: Failed resolution of: Lcom/google/android/gms/R$styleable; at at com.google.android.gms.internal.zzix.<init>(Unknown Source:9) at at com.google.android.gms.internal.zzlb.<init>(Unknown Source:49) at at com.google.android.gms.internal.zzlb.<init>(Unknown Source:7) at at com.google.android.gms.internal.zzlb.<init>(Unknown Source:7) at at com.google.android.gms.ads.BaseAdView.<init>(Unknown Source:6) at at com.google.android.gms.ads.AdView.<init>(Unknown Source:1) at ... 26 more at Caused by: java.lang.ClassNotFoundException: Didn't find class "com.google.android.gms.R$styleable" on path: DexPathList[[zip file "/data/app/com.companyname.Xamarin_Android_AdMob-Vo0ea06lDhoddjE6C9rhCQ==/base.apk"],nativeLibraryDirectories=[/data/app/com.companyname.Xamarin_Android_AdMob-Vo0ea06lDhoddjE6C9rhCQ==/lib/arm64, /system/fake-libs64, /data/app/com.companyname.Xamarin_Android_AdMob-Vo0ea06lDhoddjE6C9rhCQ==/base.apk!/lib/arm64-v8a, /system/lib64, /system/vendor/lib64]] at at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:93) at at java.lang.ClassLoader.loadClass(ClassLoader.java:379) at at java.lang.ClassLoader.loadClass(ClassLoader.java:312) at ... 32 more --- End of inner exception stack trace --- at android.view.InflateException: Binary XML file line #1: Error inflating class com.google.android.gms.ads.AdView at Caused by: java.lang.reflect.InvocationTargetException at at java.lang.reflect.Constructor.newInstance0(Native Method) at at java.lang.reflect.Constructor.newInstance(Constructor.java:334) at at android.view.LayoutInflater.createView(LayoutInflater.java:647) at at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:790) at at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:730) at at android.view.LayoutInflater.rInflate(LayoutInflater.java:863) at at android.view.LayoutInflater.rInflateChildren(LayoutInflater.java:824) at at android.view.LayoutInflater.inflate(LayoutInflater.java:515) at at android.view.LayoutInflater.inflate(LayoutInflater.java:423) at at android.view.LayoutInflater.inflate(LayoutInflater.java:374) at at com.android.internal.policy.PhoneWindow.setContentView(PhoneWindow.java:418) at at android.app.Activity.setContentView(Activity.java:2654) at at md590b51b04120f98b286fdabac728c8b6d.MainActivity.n_onCreate(Native Method) at at md590b51b04120f98b286fdabac728c8b6d.MainActivity.onCreate(MainActivity.java:29) at at android.app.Activity.performCreate(Activity.java:6975) at at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1214) at at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2775) at at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2897) at at android.app.ActivityThread.-wrap11(Unknown Source:0) at at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1598) at at android.os.Handler.dispatchMessage(Handler.java:105) at at android.os.Looper.loop(Looper.java:251) at at android.app.ActivityThread.main(ActivityThread.java:6572) at at java.lang.reflect.Method.invoke(Native Method) at at com.android.internal.os.Zygote$MethodAndArgsCaller.run(Zygote.java:240) at at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:767) at Caused by: java.lang.NoClassDefFoundError: Failed resolution of: Lcom/google/android/gms/R$styleable; at at com.google.android.gms.internal.zzix.<init>(Unknown Source:9) at at com.google.android.gms.internal.zzlb.<init>(Unknown Source:49) at at com.google.android.gms.internal.zzlb.<init>(Unknown Source:7) at at com.google.android.gms.internal.zzlb.<init>(Unknown Source:7) at at com.google.android.gms.ads.BaseAdView.<init>(Unknown Source:6) at at com.google.android.gms.ads.AdView.<init>(Unknown Source:1) at ... 26 more at Caused by: java.lang.ClassNotFoundException: Didn't find class "com.google.android.gms.R$styleable" on path: DexPathList[[zip file "/data/app/com.companyname.Xamarin_Android_AdMob-Vo0ea06lDhoddjE6C9rhCQ==/base.apk"],nativeLibraryDirectories=[/data/app/com.companyname.Xamarin_Android_AdMob-Vo0ea06lDhoddjE6C9rhCQ==/lib/arm64, /system/fake-libs64, /data/app/com.companyname.Xamarin_Android_AdMob-Vo0ea06lDhoddjE6C9rhCQ==/base.apk!/lib/arm64-v8a, /system/lib64, /system/vendor/lib64]] at at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:93) at at java.lang.ClassLoader.loadClass(ClassLoader.java:379) at at java.lang.ClassLoader.loadClass(ClassLoader.java:312) at ... 32 more --- End of inner exception stack trace --- at android.view.InflateException: Binary XML file line #1: Binary XML file line #1: Error inflating class com.google.android.gms.ads.AdView at Caused by: android.view.InflateException: Binary XML file line #1: Error inflating class com.google.android.gms.ads.AdView at Caused by: java.lang.reflect.InvocationTargetException at at java.lang.reflect.Constructor.newInstance0(Native Method) at at java.lang.reflect.Constructor.newInstance(Constructor.java:334) at at android.view.LayoutInflater.createView(LayoutInflater.java:647) at at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:790) at at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:730) at at android.view.LayoutInflater.rInflate(LayoutInflater.java:863) at at android.view.LayoutInflater.rInflateChildren(LayoutInflater.java:824) at at android.view.LayoutInflater.inflate(LayoutInflater.java:515) at at android.view.LayoutInflater.inflate(LayoutInflater.java:423) at at android.view.LayoutInflater.inflate(LayoutInflater.java:374) at at com.android.internal.policy.PhoneWindow.setContentView(PhoneWindow.java:418) at at android.app.Activity.setContentView(Activity.java:2654) at at md590b51b04120f98b286fdabac728c8b6d.MainActivity.n_onCreate(Native Method) at at md590b51b04120f98b286fdabac728c8b6d.MainActivity.onCreate(MainActivity.java:29) at at android.app.Activity.performCreate(Activity.java:6975) at at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1214) at at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2775) at at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2897) at at android.app.ActivityThread.-wrap11(Unknown Source:0) at at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1598) at at android.os.Handler.dispatchMessage(Handler.java:105) at at android.os.Looper.loop(Looper.java:251) at at android.app.ActivityThread.main(ActivityThread.java:6572) at at java.lang.reflect.Method.invoke(Native Method) at at com.android.internal.os.Zygote$MethodAndArgsCaller.run(Zygote.java:240) at at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:767) at Caused by: java.lang.NoClassDefFoundError: Failed resolution of: Lcom/google/android/gms/R$styleable; at at com.google.android.gms.internal.zzix.<init>(Unknown Source:9) at at com.google.android.gms.internal.zzlb.<init>(Unknown Source:49) at at com.google.android.gms.internal.zzlb.<init>(Unknown Source:7) at at com.google.android.gms.internal.zzlb.<init>(Unknown Source:7) at at com.google.android.gms.ads.BaseAdView.<init>(Unknown Source:6) at at com.google.android.gms.ads.AdView.<init>(Unknown Source:1) at ... 26 more at Caused by: java.lang.ClassNotFoundException: Didn't find class "com.google.android.gms.R$styleable" on path: DexPathList[[zip file "/data/app/com.companyname.Xamarin_Android_AdMob-Vo0ea06lDhoddjE6C9rhCQ==/base.apk"],nativeLibraryDirectories=[/data/app/com.companyname.Xamarin_Android_AdMob-Vo0ea06lDhoddjE6C9rhCQ==/lib/arm64, /system/fake-libs64, /data/app/com.companyname.Xamarin_Android_AdMob-Vo0ea06lDhoddjE6C9rhCQ==/base.apk!/lib/arm64-v8a, /system/lib64, /system/vendor/lib64]] at at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:93) at at java.lang.ClassLoader.loadClass(ClassLoader.java:379) at at java.lang.ClassLoader.loadClass(ClassLoader.java:312) at ... 32 more