1

I created an application a few weeks ago to learn how to use native Admob + Firebase ads. When opening the app, the ads are not loaded and said that error 3 occurred.

class MainActivity : AppCompatActivity() {

    private var adLoader: AdLoader? = null
    private val mRecyclerViewItems: MutableList<Any> = ArrayList()
    private val mNativeAds: MutableList<UnifiedNativeAd> = ArrayList()
    //...

        private fun loadNativeAds() {
            val builder = AdLoader.Builder(this, getString(R.string.ad_unit_id))
            adLoader = builder.forUnifiedNativeAd { unifiedNativeAd ->
                mNativeAds.add(unifiedNativeAd)
                if (!adLoader!!.isLoading) {
                    insertAdsInMenuItems()
                }
            }.withAdListener(
                object : AdListener() {
                    override fun onAdFailedToLoad(errorCode: Int) { 
                        Log.e(
                            "MainActivity", "The previous native ad failed to load. Attempting to"
                                    + " load another." + "error: " + errorCode
                        )
                        if (!adLoader!!.isLoading) {
                            insertAdsInMenuItems()
                        }
                    }
                }).build()
            // Load the Native ads.
            adLoader?.loadAds(
                AdRequest.Builder().build(),
                NUMBER_OF_ADS
            )
        }

2020-02-26 15:47:59.101 14404-14404/? E/MainActivity: The previous native ad failed to load. Attempting to load another.error: 3

build.gradle :

implementation 'com.google.firebase:firebase-ads:15.0.0'
implementation 'com.google.firebase:firebase-analytics:17.2.2'

After researching this error, I found that many people are facing the same problem, a long time ago as seen here.

I believe I made the correct configuration of the app menu with firebase and admob. Is there any way to check this? Many people are having the same problem and this is a critical part of many apps. Is there any way to correct this problem?

Thanks in advance!

Vitor Ferreira
  • 1,075
  • 1
  • 14
  • 28

0 Answers0