0

On some android phones only the latest build of our app is crashing with

Unable to get provider com.google.android.gms.ads.MobileAdsInitProvider: java.lang.ClassNotFoundException

It's occurring on a phone running Android 5.1.1.

The problem is NOT multidex-related (all other answers I've googled relate to multidex; we've had multidex enabled in our apps for years).

I'm assuming it's related to us updating to the latest Admob, but I haven't been able to find any related advice online.

We're pulling in the following:

    dependencies {
        classpath 'com.android.tools.build:gradle:3.0.1'
        classpath 'com.google.gms:google-services:4.2.0'
    }

dependencies {
    // NEW FUSE INTEGRATION
    compile('com.upsight.android:mediation-core:2.12.0') {
        exclude group: 'com.google.android.gms', module: 'play-services'
        //exclude group: 'com.google.android.gms', module: 'play-services-basement'
        exclude group: 'com.android.support'
        exclude group: 'com.upsight.android', module: 'mediation-ad-network-u2'
        exclude group: 'com.upsight.android', module: 'mediation-ad-network-m2'
        exclude group: 'com.upsight.android', module: 'mediation-ad-network-ac'
        exclude group: 'com.upsight.android', module: 'mediation-ad-network-al'
        exclude group: 'com.upsight.android', module: 'mediation-ad-network-vungle'
    }
    compile 'com.android.support:appcompat-v7:26.1.0'

    compile 'com.android.support:support-v13:26.1.0'
    compile 'com.android.support:design:26.1.0'
    compile 'com.android.support:multidex:1.0.3'
    // compile files('libs/FlurryAnalytics_6.7.0.jar')
    implementation 'com.flurry.android:analytics:11.3.0@aar'
    // compile 'com.flurry.android:marketing:11.3.0@aar' ' No longer needed for Push'

    implementation 'com.google.firebase:firebase-core:16.0.4'
    implementation 'com.google.firebase:firebase-messaging:17.3.4'
    implementation 'com.google.firebase:firebase-ads:17.0.0'
    implementation('com.adincube.sdk:AdinCube-Java-1626ebe:2.+@aar') {
        transitive = true
    }
    implementation 'com.google.android.ads.consent:consent-library:1.0.6'

    //  Fyber
    implementation (name:'ia-sdk-core-release-7.3.1', ext:'aar')
    implementation (name:'ia-video-kit-release-7.3.1', ext:'aar')
    implementation (name:'ia-mraid-kit-release-7.3.1', ext:'aar')
    implementation (name:'ia-native-kit-release-7.3.1', ext:'aar')
    implementation 'com.google.code.gson:gson:2.7'
    implementation ('com.google.android.gms:play-services-base:16.1.0')
    //implementation ('com.google.android.gms:play-services-ads-identifier:17.2.0')
}
mohammadReza Abiri
  • 1,759
  • 1
  • 9
  • 20
Peeling
  • 356
  • 1
  • 12
  • is it happening with release build? – Rajasekaran M Sep 11 '19 at 12:48
  • see this link may help you : https://stackoverflow.com/questions/54184851/java-lang-classnotfoundexception-didnt-find-class-com-google-android-gms-ads – mohammadReza Abiri Sep 11 '19 at 13:05
  • maybe try the latest version: `implementation 'com.google.android.gms:play-services-ads:18.2.0'`, but this version relies on AndroidX dependency. – Darshan Sep 11 '19 at 17:06
  • Regarding the above link: as I said the problem is not related to multidex. I found that question/answer while I was googling before posting this question. – Peeling Sep 12 '19 at 11:50

1 Answers1

0

In this case, updating the Gradle build tools to

com.android.tools.build:gradle:3.1.3

eliminated the problem. Previously they were at 3.0.1

So, one more thing for people to try if they come across this problem!

AgentP
  • 6,261
  • 2
  • 31
  • 52
Peeling
  • 356
  • 1
  • 12