2

I saw several answers to this problem, but nothing seems to help. I am installing my self signed Release-APK on a Samsung Galaxy S3 without any problem. Starting the app produces the following Exception;

java.lang.RuntimeException: Unable to get provider com.google.firebase.provider.FirebaseInitProvider: java.lang.ClassNotFoundException: Didn't find class "com.google.firebase.provider.FirebaseInitProvider" on path: /data/app/de.myapp.app-2.apk

Here's my gradle script (app):

apply plugin: 'com.android.application'

android {
    compileSdkVersion 24
    buildToolsVersion "24.0.0"
    defaultConfig {
        applicationId "de.myapp.app"
        minSdkVersion 18
        targetSdkVersion 24
        versionCode 1
        versionName "1.0"
        testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
    }
    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
    }
}

dependencies {
    compile fileTree(dir: 'libs', include: ['*.jar'])
    androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', {
        exclude group: 'com.android.support', module: 'support-annotations'
    })
    compile 'com.android.support:appcompat-v7:24.2.1'
    testCompile 'junit:junit:4.12'

    compile 'com.google.android.gms:play-services-location:9.6.1'
    compile 'com.google.android.gms:play-services-maps:9.6.1'
}

I tried using only specific google play services. Didn't help. Works fine with the emulator and on my Nexus 5.

Marcin Orlowski
  • 72,056
  • 11
  • 123
  • 141
DoubleVoid
  • 777
  • 1
  • 16
  • 46

1 Answers1

2

It's because you are using the google play services which includes firebase analytics which is bogus on sad-sung. You can disable it by doing a

configurations {
    all*.exclude group: 'com.google.firebase', module: 'firebase-common'
}

or

configurations {
    all*.exclude group: 'com.google.firebase', module: 'firebase-core'
    all*.exclude group: 'com.google.firebase', module: 'firebase-iid'
}

(source)

Community
  • 1
  • 1
Gabor
  • 7,352
  • 4
  • 35
  • 56
  • Hi I tried to verify it, but it seems to work now anyway. Guess switching to the lower API level installed something on my device?! I used adb -d uninstall to remove the app...your solution would be cooler, but I can't verify it now... – DoubleVoid Oct 19 '16 at 20:31
  • But what the other answer recommended you was to use "at least Android 4.1" (at least API level 16) which you already did (you were using API level 18). Glad that it works now but no one told you to downgrade to API level 16. – Gabor Oct 19 '16 at 22:35
  • I changed the TargetSDK from 24 (7.0) to 16 (4.1) and it worked. MinSDK from 18 (4.3) to 16. But after doing so I can rollback all changes or use your solution and it works anyway. Something got upgraded or downgraded on my device. Any clue on how to undo it (whatever it was) to verify your solution?! Maybe some Firebase binaries are still on my device, even after uninstalling the app?! – DoubleVoid Oct 20 '16 at 08:53
  • About targetsdk, you should not downgrade it, "To maintain your application along with each Android release, you should increase the value of this attribute (android:targetSdkVersion) to match the latest API level," taken from https://developer.android.com/guide/topics/manifest/uses-sdk-element.html – Gabor Oct 20 '16 at 18:55