DarShan Pandya

VerifyError (TabLayout & AdMob SDK)

Getting errors or crashes right after updating dependencies and pushing the update to production can be very frustrating!

* Material Components (TabLayout)

So, I updated the Google Material Components library to 1.1.0-alpha07 and it worked fine.
Pushed the update to production at 2% users..

I have a huge number of users for my apps so, I never push my apps to 100% rollout untill I’m sure that everything is fine.

Hopefully, I use Crashlytics!
The moment a crash occurs, I can see its details in the Firebase Crashlytics’ dashboard..

The Crashed I got were 100% from 4.x devices, a little investigation and I found that Proguard/R8 stripped TabLayout$Tab class during app build process.
But, I found a solution where you’d have to keep the TabLayout$Tab class, so the solution was to add the following in the proguard file¬† –

-keep class com.google.android.material.tabs.TabLayout$Tab { *; }

* AdMob SDK

The issue I faced with updated AdMob SDK (18.1.0) was slightly different..
I used the same as above for the missing class, here AdView, but still got the crash on a 4.x emulator.

The package was –

com.google.android.gms.ads.AdView

so I added the class in the proguard as follows –

-keep class com.google.android.gms.ads.AdView { *; }

but it still didn’t work..

I tried by removing the AdView and keeping the whole “ads” package, & that didn’t work too..

But finally!
I kept the whole “gms” package & it worked..
The final solution –

-keep class com.google.android.gms.** { *; }

1 Comment

Leave a Comment