Posts tagged with google-play-services

I updated the libraries on my Xamarin Android application, and I get the following error: com.google.android.gms.internal.ads.zza is defined multiple times: obj\Debug\120\lp\107\jl\bin\classes.jar:com/google/android/gms/internal/ads/zza.class, obj\Debug\120\lp\116\jl\bin\classes.jar:com/google/android/gms/internal/ads/zza.class

Here are the libraries that collide based on the manifest files found in these folders:

  • com.google.android.gms.gass -> Xamarin.GooglePlayServices.Gass version 120.0.0.7
  • com.google.android.gms.ads.impl -> I assume it's Xamarin.GooglePlayServices.Ads version 121.3.0

Is there any thoughts how can I overcome this issue? My app does not build. I tried many version combinations, none of them helped.

I tried many version combinations, none of them helped.

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> 

having function to get AdvertisingIdClient.Info

private static AdvertisingIdClient.Info getAdsClientInfo(@NonNull final Context context) throws GooglePlayServicesNotAvailableException, IOException, GooglePlayServicesRepairableException {     int isGPAvailable = GoogleApiAvailability.getInstance().isGooglePlayServicesAvailable(context);     if (isGPAvailable == ConnectionResult.SUCCESS) {         return AdvertisingIdClient.getAdvertisingIdInfo(context);     }     return null; } 

it uses AdvertisingIdClient.getAdvertisingIdInfo(context)

there are three libs in https://developers.google.com/android/guides/setup

Google Mobile Ads   com.google.android.gms:play-services-ads:20.1.0 Android Advertising ID (AAID)   com.google.android.gms:play-services-ads-identifier:17.0.0 Lightweight version of Google Mobile Ads com.google.android.gms:play-services-ads-lite:20.1.0 

what are the difference among these, and which one is safe to use for the purpose?

The production instance of my android app has been crashing. The stack trace isn't much useful. The crash may be coming off of com.google.android.gms.common.GooglePlayServicesUtilLight.getRemoteContext but it may not be the ultimate culprit. Pasting the stack trace below:

Fatal Exception: java.lang.RuntimeException: android.os.DeadSystemException        at android.app.LoadedApk.createOrUpdateClassLoaderLocked(LoadedApk.java:746)        at android.app.LoadedApk.access$100(LoadedApk.java:99)        at android.app.LoadedApk$SplitDependencyLoaderImpl.constructSplit(LoadedApk.java:597)        at android.content.pm.split.SplitDependencyLoader.loadDependenciesForSplit(SplitDependencyLoader.java:70)        at android.app.LoadedApk$SplitDependencyLoaderImpl.ensureSplitLoaded(LoadedApk.java:632)        at android.app.LoadedApk$SplitDependencyLoaderImpl.getSplitPathsForSplit(LoadedApk.java:641)        at android.app.LoadedApk.getSplitPaths(LoadedApk.java:658)        at android.app.ContextImpl.createResources(ContextImpl.java:2152)        at android.app.ContextImpl.createPackageContextAsUser(ContextImpl.java:2214)        at android.app.ContextImpl.createPackageContext(ContextImpl.java:2193)        at android.content.ContextWrapper.createPackageContext(ContextWrapper.java:884)        at com.google.android.gms.common.GooglePlayServicesUtilLight.getRemoteContext(GooglePlayServicesUtilLight.java:125)        at com.google.android.gms.internal.ads.zzabl.initialize(zzabl.java:23)        at com.google.android.gms.internal.ads.zzabp.zzi(zzabp.java:15)        at com.google.android.gms.internal.ads.zzabo.get(zzabo.java:11)        at com.google.android.gms.ads.internal.util.zzbr.zza(zzbr.java:13)        at com.google.android.gms.internal.ads.zzabp.initialize(zzabp.java:1)        at com.google.android.gms.internal.ads.zzamy.run(zzamy.java:2)        at java.lang.Thread.run(Thread.java:919) 

Please take a look and let me know if any more details are required to be shared. I am using the following dependencies for google ads API:

implementation 'com.google.android.gms:play-services-ads:19.7.0' implementation group: 'com.github.ankitbatra11', name: 'billboard', version: '2.0.1' implementation group: 'com.google.ads.mediation', name: 'facebook', version: '6.2.0.1' implementation group: 'com.google.ads.mediation', name: 'adcolony', version: '4.4.0.0' 

After updating Google Ads SDK to 19.0.0 gives a deprecated warning message for addTestDevice(), while I searched this link for resolving the issue but not succeed. how can I resolve it?

Here my code

mAdView.loadAd(new RequestConfiguration.Builder        .setTestDeviceIds(AdRequest.DEVICE_ID_EMULATOR) // show error        .setTestDeviceIds(DEV_ID) // show error        .build()); 

and developer site suggestion

Deprecated AdRequest.Builder.addTestDevice(). Use RequestConfiguration.Builder.setTestDeviceIds() instead.