【问题标题】:"No ad config" while adding admob bannner/interstitial Ad in Android Kotlin在 Android Kotlin 中添加 admob 横幅/插页式广告时出现“无广告配置”
【发布时间】:2021-04-17 13:50:14
【问题描述】:

我刚刚实现了显示插页式广告和横幅广告的代码,但我收到“没有广告配置错误代码:3”。该应用程序是一个客户项目,它是一个盗版的东西。昨天该应用程序在模拟器上运行良好(即使使用生产广告 ID)但今天在模拟器和真实设备中两个应用程序都没有加载.. Manifest

横幅广告代码 -

val mAdView = binding.bannerAd
        val adRequest = AdRequest.Builder().build()
        mAdView.adListener = object: AdListener() {
            override fun onAdLoaded() {
                // Code to be executed when an ad finishes loading.
            }

            override fun onAdFailedToLoad(adError : LoadAdError) {
                Log.e("AD", "BANNER ADD FAILED TO LOAD $adError")
            }

            override fun onAdOpened() {
                // Code to be executed when an ad opens an overlay that
                // covers the screen.
            }

            override fun onAdClicked() {
                // Code to be executed when the user clicks on an ad.
            }

            override fun onAdLeftApplication() {
                // Code to be executed when the user has left the app.
            }

            override fun onAdClosed() {
                // Code to be executed when the user is about to return
                // to the app after tapping on an ad.
            }
        }

        mAdView.loadAd(adRequest)

插页式广告代码 -

var mInterstitialAd: InterstitialAd? = null
    var TAG = "AD"
    var adRequest = AdRequest.Builder().build()
    InterstitialAd.load(
        context,
        "ca-app-pub-xxxxx/xxxxxx", // I Have real id here
        adRequest,
        object : InterstitialAdLoadCallback() {
            override fun onAdFailedToLoad(adError: LoadAdError) {
                Log.e("AD", adError?.message)
                mInterstitialAd = null
            }

            override fun onAdLoaded(interstitialAd: InterstitialAd) {
                mInterstitialAd = interstitialAd

                mInterstitialAd?.fullScreenContentCallback = object: FullScreenContentCallback() {
                    override fun onAdDismissedFullScreenContent() {
                        Log.d(TAG, "Ad was dismissed.")
                    }

                    override fun onAdFailedToShowFullScreenContent(adError: AdError?) {
                        Log.d(TAG, "Ad failed to show.")
                    }

                    override fun onAdShowedFullScreenContent() {
                        Log.d(TAG, "Ad showed fullscreen content.")
                        mInterstitialAd = null;
                    }
                }

                if (mInterstitialAd != null) {
                    mInterstitialAd?.show(activity)
                } else {
                }
            }
        }
    )

【问题讨论】:

  • 嗨,我也面临同样的问题。运气好的话?你解决了吗?

标签: android kotlin admob ads adsense


【解决方案1】:

我认为这是服务器端问题,请尝试更改包名称然后测试。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2013-10-23
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2014-08-28
    相关资源
    最近更新 更多