Posts tagged with admob

I need some help.

As described in the Title, the Google AdsMob does not work properly.

I built the app according to the tutorial, however i receive the above mentioned error plist:

<key>GADApplicationIdentifier</key> <string>app id from google</string> 

Viewcontroller:

private let banner: GADBannerView = {     let banner = GADBannerView()     banner.adUnitID = Banner ID     banner.load(GADRequest())     banner.backgroundColor = .secondarySystemBackground     return banner }() viewDidLoad(){ banner.rootViewController = self         view.addSubview(banner) } 

It seems that it doesn't matter wether the banner.view is created or not. The app shows a black screen an error message is:

[I-ACS025031] AdMob App ID changed. Original, new: (nil),

I am working with a Macbook Air M1

I have a application with a ads. And i have a 1 banner ads. Can i use same unit id for use more than 1 banner only ? Like if i want use 3 banner should i take 3 diffrent banner id or same is working well too ? I googled it but cant found any document or same question as i asked thats why i want to ask in here .If i can use then i will put two or three ads with same id. And is it effecting money to get ? I just need informations about it. Thanks for helps :)

secondBanner = BannerAd(       size: AdSize.banner,       adUnitId: "MyBannerId",       listener: BannerAdListener(onAdLoaded: (ad) {         setState(() {           secondBannerLoaded = true;         });         print("Banner AD LOADED!!!!!!!!!!!");       }, onAdFailedToLoad: (ad, error) {         print("Banner AD ERRRRRRRRRRRRRRRRRRRR!!!!!!!!!!!");         inspect(error);         ad.dispose();       }),       request: AdRequest(),     );     bannerAd = BannerAd(       size: AdSize.banner,       adUnitId: "MyBannerId",       listener: BannerAdListener(onAdLoaded: (ad) {         setState(() {           isLoaded = true;         });         print("Banner AD LOADED!!!!!!!!!!!");       }, onAdFailedToLoad: (ad, error) {         print("Banner AD ERRRRRRRRRRRRRRRRRRRR!!!!!!!!!!!");         inspect(error);         ad.dispose();       }),       request: AdRequest(),     );     bannerAd!.load();     secondBanner!.load(); 

I have a problem implementing AdMob with my Android app, ads are not showing for my package name, I changed the name and everything works fine, I restored the prod name and everything stopped working with the error: no ad config, this is my first time using AdMob, which means the ads work for a while and then suddenly stop is not the case here, I don't suspect anything wrong with the code because I followed everything in the documentation and, as I said, everything works fine when I change the package name to a random string.

  1. Is app-ads.txt correct? yes, app-ads.txt file found and verified (100% of queries authorized)
  2. Policy center: no current issues, no disapproved apps
  3. App linked to admob? yes it is linked through google play and I noticed the icon is updated
  4. PIN verification: I still didn't reach the verification threshold
  5. Is Google Ads and Adsense linked to Admob? yes, and with the same email
  6. Admob status: Your account is approved
  7. App approval status: Ready (Ad serving enabled)
  8. App stores: Google Play
  9. Ad format: Rewarded
  10. Ads activity performance, Requests: 0 (ZERO)

Note 1: the email I am using on play console is diff from the email of admob / ads / adsense

Note 2: the prod app is already launched in google play store

Any help guys?

MainActivity.java:

package com.example.admob; import androidx.annotation.NonNull; import androidx.appcompat.app.AppCompatActivity; import android.app.Activity; import android.os.Bundle; import android.util.Log; import android.view.View; import android.widget.Toast; import com.google.android.gms.ads.AdRequest; import com.google.android.gms.ads.LoadAdError; import com.google.android.gms.ads.MobileAds; import com.google.android.gms.ads.OnUserEarnedRewardListener; import com.google.android.gms.ads.RequestConfiguration; import com.google.android.gms.ads.initialization.InitializationStatus; import com.google.android.gms.ads.initialization.OnInitializationCompleteListener; import com.google.android.gms.ads.rewarded.RewardItem; import com.google.android.gms.ads.rewarded.RewardedAd; import com.google.android.gms.ads.rewarded.RewardedAdLoadCallback; import java.util.Arrays; public class MainActivity extends AppCompatActivity {     private RewardedAd mRewardedAd;     @Override     protected void onCreate(Bundle savedInstanceState) {         super.onCreate(savedInstanceState);         setContentView(R.layout.activity_main);         /**/         RequestConfiguration configuration = new RequestConfiguration.Builder().setTestDeviceIds(Arrays.asList("PEO7WS709MHDMHS0KA74LQ4KDPL9V8DJ")).build();         /**/         MobileAds.setRequestConfiguration(configuration);         /**/         MobileAds.initialize(this, new OnInitializationCompleteListener() {             @Override             public void onInitializationComplete(InitializationStatus initializationStatus) {             }         });         AdRequest adRequest = new AdRequest.Builder().build();         RewardedAd.load(this, "ca-app-pub-2887021452579791/7518976046",                 adRequest, new RewardedAdLoadCallback() {                     @Override                     public void onAdFailedToLoad(@NonNull LoadAdError loadAdError) {                         // Handle the error.                         Log.d(TAG, loadAdError.getMessage());                         Toast.makeText(MainActivity.this, loadAdError.getMessage(), Toast.LENGTH_SHORT).show();                         mRewardedAd = null;                     }                     @Override                     public void onAdLoaded(@NonNull RewardedAd rewardedAd) {                         mRewardedAd = rewardedAd;                         Log.d(TAG, "Ad was loaded.");                         Toast.makeText(MainActivity.this, "Ad was loaded", Toast.LENGTH_SHORT).show();                     }                 });         findViewById(R.id.button).setOnClickListener(new View.OnClickListener() {             @Override             public void onClick(View view) {                 if (mRewardedAd != null) {                     Activity activityContext = MainActivity.this;                     mRewardedAd.show(activityContext, new OnUserEarnedRewardListener() {                         @Override                         public void onUserEarnedReward(@NonNull RewardItem rewardItem) {                             // Handle the reward.                             Log.d(TAG, "The user earned the reward.");                             Toast.makeText(MainActivity.this, "onUserEarnedReward", Toast.LENGTH_SHORT).show();                         }                     });                 } else {                     Log.d(TAG, "The rewarded ad wasn't ready yet.");                     Toast.makeText(MainActivity.this, "Not ready!", Toast.LENGTH_SHORT).show();                 }             }         });     } } 

Manifest.xml:

<?xml version="1.0" encoding="utf-8"?> <manifest xmlns:android="http://schemas.android.com/apk/res/android"     package="com.example.admob">     <application         android:allowBackup="true"         android:icon="@mipmap/ic_launcher"         android:label="@string/app_name"         android:roundIcon="@mipmap/ic_launcher_round"         android:supportsRtl="true"         android:theme="@style/Theme.AdMob">         <meta-data             android:name="com.google.android.gms.ads.APPLICATION_ID"             android:value="ca-app-pub-2887021452579791~7783129272"/>         <activity             android:name=".MainActivity"             android:exported="true">             <intent-filter>                 <action android:name="android.intent.action.MAIN" />                 <category android:name="android.intent.category.LAUNCHER" />             </intent-filter>         </activity>     </application> </manifest> 

We are trying to implement the Mediation Test Suite but, we are getting the following error message:

Undefined symbols for architecture arm64: "_kGADSimulatorID", referenced from: _GMTSMediationRequest in GoogleMobileAdsMediationTestSuite(GMTSMediationHelper.o)
"_kGADAdSizeBanner", referenced from: -[GMTSBannerAdLoader initWithAdUnitId:rootViewController:] in GoogleMobileAdsMediationTestSuite(GMTSBannerAdLoader.o)
"_kGADAdLoaderAdTypeNative", referenced from: -[GMTSNativeAdLoader initWithAdUnitId:rootViewController:] in GoogleMobileAdsMediationTestSuite(GMTSNativeAdLoader.o) ld: symbol(s) not found for architecture arm64 clang: error: linker command failed with exit code 1 (use -v to see invocation)

The app is crashing on launch after implementing google ads. I'm using an ios simulator. Ads are working fine on the other apps with the same code implementation but not on this app. Others apps are displaying test ads even with original Ad Units IDs. Interstitial Ads and Rewarded Ads are working fine only banner ads got the issue.

The error: To get test ads on this device, set: Objective-C GADMobileAds.sharedInstance.requestConfiguration.testDeviceIdentifiers = @[ kGADSimulatorID ]; Swift GADMobileAds.sharedInstance().requestConfiguration.testDeviceIdentifiers = [ kGADSimulatorID ]

Code: AdHelper Class

import 'package:google_mobile_ads/google_mobile_ads.dart'; import 'dart:io'; class AdHelper{   //  Android Ad Units   static String _bannerAd_And = 'ca-app-pub-3884661730977437/3917788070';   static String _interAd_And = 'ca-app-pub-3884661730977437/1291624734';   static String _bannerAdTest_And = 'ca-app-pub-3940256099942544/6300978111';   static String _interAdTest_And = 'ca-app-pub-3940256099942544/1033173712';   //  iOS Ad Units   static String _bannerAd_iOS = 'ca-app-pub-3884661730977437/4131225272';   static String _interAd_iOS = 'ca-app-pub-3884661730977437/6845018522';   static String _bannerAdTest_iOS = 'ca-app-pub-3940256099942544/2934735716';   static String _interAdTest_iOS = 'ca-app-pub-3940256099942544/4411468910'; // FN returns Banner AD Unit Id   static String get bannerAdUnitId {     if (Platform.isAndroid) {       return _bannerAdTest_And;     } else if (Platform.isIOS) {       return _bannerAdTest_iOS;     } else {       throw UnsupportedError('Unsupported platform');     }   }   // FN returns Interstitial Ad Unit Id   static String get interAdUnitId {     if (Platform.isAndroid) {       return _interAdTest_And;     } else if (Platform.isIOS) {       return _interAdTest_iOS;     } else {       throw UnsupportedError('Unsupported platform');     }   } } 

AdController

import 'package:get/get.dart'; import 'package:google_mobile_ads/google_mobile_ads.dart'; import 'AdMob_Helper.dart'; class AdMobController extends GetxController{   ///------------------  Init   @override   void onInit() {     getBannerAd();     super.onInit();   }   ///------------------  Dispose   @override   void onClose() {     bannerAd.dispose();     super.onClose();   }   late BannerAd bannerAd;   bool isBannerLoaded = false;   //   void getBannerAd() {     bannerAd = BannerAd(       adUnitId: AdHelper.bannerAdUnitId,       size: AdSize.banner,       request: AdRequest(),       listener: BannerAdListener(         onAdLoaded: (_) {           isBannerLoaded = true;           update();         },         onAdFailedToLoad: (ad, error) {           // Releases an ad resource when it fails to load           ad.dispose();           print('Ad load failed (code=${error.code} message=${error.message})');         },       ),     );     // TODO: Load an ad     bannerAd.load();     update();   } }