Problem with newest com.google.android.gms:play-services-ads version – Android

by
Ali Hasan
android android-gradle-plugin spreadsheet

Quick Fix: Update the com.google.firebase:firebase-analytics to the latest version (21.3.0) in your project’s dependencies.

The Problem:

When using com.google.android.gms:play-services-ads:22.0.0 library, an error occurs during the build process due to a failure in transforming the library’s JAR file. The error message indicates an issue while instrumenting a specific class (com.google.android.gms.internal.ads.zzaqx). This error prevents the successful execution of the AsmClassesTransform task.

The Solutions:

Solution 1: Update `com.google.firebase:firebase-analytics` library to the newest version

The problem can be solved by updating the `com.google.firebase:firebase-analytics` library to the newest version. The dependencies section in the build.gradle file should be updated as follows:

dependencies {
    ...
    // Updated firebase-analytics to the latest version
    implementation 'com.google.firebase:firebase-analytics:21.3.0'
    ...
}

Solution 2: Use Multidex Builder

Multidex Builder is the source of the issue. In reality, this frequently occurs when you import many packages into your file, which cannot all fit into a single.dex build, necessitating the use of multidex.

Open android/app/build.gradle and add the following lines of code:

Note: Make sure you use latest multidex version

 dependencies {   
      implementation 'com.android.support:multidex:2.0.1' 
  } 

 android {
     defaultConfig {
        multiDexEnabled true
     } 
}

Video Explanation:

The following video, titled "Admob Solve the problem com.google.android.gms:play-services ...", provides additional insights and in-depth exploration related to the topics discussed in this post.

Play video

Solve the problem ERROR: Manifest merger failed : Attribute application@appComponentFactory value= android.support.v4.app.