android adview源码,admob - Android: ANR when creating AdView - Stack Overflow

罗烨霖
2023-12-01

For the past week I started getting a lot of ANR reports related to AdMob, AdView creation.

I didn't change anything in my code though.

I'm creating it in my Activity onCreate() method like this:

this.adView = new AdView(this, AdSize.SMART_BANNER, "axxxxxxxxxxxxxx");

Here's the ANR stack I'm getting

at dalvik.system.DexFile.openDexFile(Native Method)

at dalvik.system.DexFile.(DexFile.java:93)

at dalvik.system.DexFile.loadDex(DexFile.java:133)

at dalvik.system.DexPathList.loadDexFile(DexPathList.java:261)

at dalvik.system.DexPathList.makeDexElements(DexPathList.java:229)

at dalvik.system.DexPathList.(DexPathList.java:96)

at dalvik.system.BaseDexClassLoader.(BaseDexClassLoader.java:52)

at dalvik.system.DexClassLoader.(DexClassLoader.java:57)

at com.google.ads.ag.b(SourceFile:95)

at com.google.ads.ag.a(SourceFile:69)

at com.google.ads.bp.(SourceFile:158)

at com.google.ads.a.w.(SourceFile:266)

at com.google.ads.AdView.a(SourceFile:508)

at com.google.ads.AdView.(SourceFile:94)

I tried to create the AdView in a background thread but it seems to work only if created in the UI thread...

 类似资料: