Admob banner ad not loading in android P

前端 未结 2 1437
南笙
南笙 2021-01-01 01:12

I am using AdMob banner ads in multi-process. It is working fine on API version lower than 29 but on android-P, it is giving this error.

 com.google.android.         


        
2条回答
  •  死守一世寂寞
    2021-01-01 01:51

    in case when you deals with ads, in application class

    try {
            if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.P) {
                val process = getProcessName()
                if (packageName != process) WebView.setDataDirectorySuffix(process)
            }
    
            MobileAds.initialize(this)
            AudienceNetworkAds.initialize(this)
    
        } catch (e: Error) {
            Timber.e(e)
        } catch (e: Exception) {
            Timber.e(e)
        }
    

提交回复
热议问题