Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

FirebaseInitProvider. Resources not found [closed]

I have been using Google Firebase for a while now in application and I was doing some maintenace and a few updates but I keep getting:

Unable to get provider com.google.firebase.provider.FirebaseInitProvider

This happens whenever I launch the application. I have already tried enabling MultiDex and my applicationId has been set ever since I started using FCM. I just don't know what it could be.

Any help will be much appreciated.

build.gradle (app):

apply plugin: 'com.android.application'

android {
    compileSdkVersion 27
    defaultConfig {
    applicationId "com.vivatrucking.drivershub"
    multiDexEnabled true
    minSdkVersion 15
    targetSdkVersion 27
    versionCode 2
    versionName "1.0.1"
    testInstrumentationRunner  "android.support.test.runner.AndroidJUnitRunner"
}
buildTypes {
    release {
        minifyEnabled false
        proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
    }
  }
}

dependencies {
    implementation fileTree(dir: 'libs', include: ['*.jar'])
    implementation 'com.android.support:appcompat-v7:27.1.1'
    implementation 'com.android.support.constraint:constraint-layout:1.1.0'
    testImplementation 'junit:junit:4.12'
    androidTestImplementation 'com.android.support.test:runner:1.0.2'
    androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.2'
    // android
    implementation 'com.android.support:design:27.1.1'
    implementation 'com.android.support:cardview-v7:27.1.1'
    implementation 'com.android.support:recyclerview-v7:27.1.1'
    implementation 'com.android.volley:volley:1.0.0'
    // google
    implementation 'com.google.firebase:firebase-core:15.0.2'
    implementation 'com.google.firebase:firebase-messaging:15.0.2'
    //external libs
    implementation 'com.github.devlight:infinitecycleviewpager:1.0.2'
}
apply plugin: 'com.google.gms.google-services'

Full Stacktrace:

05-08 15:03:31.400 30530-30530/? E/AndroidRuntime: FATAL EXCEPTION: main Process: com.vivatrucking.drivershub, PID: 30530 java.lang.RuntimeException: Unable to get provider com.google.firebase.provider.FirebaseInitProvider: android.content.res.Resources$NotFoundException: Unable to find resource ID #0x7f0c002a at android.app.ActivityThread.installProvider(ActivityThread.java:6575) at android.app.ActivityThread.installContentProviders(ActivityThread.java:6127) at android.app.ActivityThread.handleBindApplication(ActivityThread.java:6037) at android.app.ActivityThread.-wrap1(Unknown Source:0) at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1764) at android.os.Handler.dispatchMessage(Handler.java:105) at android.os.Looper.loop(Looper.java:164) at android.app.ActivityThread.main(ActivityThread.java:6938) at java.lang.reflect.Method.invoke(Native Method) at com.android.internal.os.Zygote$MethodAndArgsCaller.run(Zygote.java:327) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1374) Caused by: android.content.res.Resources$NotFoundException: Unable to find resource ID #0x7f0c002a at android.content.res.ResourcesImpl.getResourcePackageName(ResourcesImpl.java:253) at android.content.res.Resources.getResourcePackageName(Resources.java:1963) at com.google.android.gms.common.internal.StringResourceValueReader.(Unknown Source:16) at com.google.firebase.FirebaseOptions.fromResource(Unknown Source:2) at com.google.firebase.FirebaseApp.initializeApp(Unknown Source:19) at com.google.firebase.provider.FirebaseInitProvider.onCreate(Unknown Source:4) at android.content.ContentProvider.attachInfo(ContentProvider.java:1925) at android.content.ContentProvider.attachInfo(ContentProvider.java:1900) at com.google.firebase.provider.FirebaseInitProvider.attachInfo(Unknown Source:23) at android.app.ActivityThread.installProvider(ActivityThread.java:6572) at android.app.ActivityThread.installContentProviders(ActivityThread.java:6127)  at android.app.ActivityThread.handleBindApplication(ActivityThread.java:6037)  at android.app.ActivityThread.-wrap1(Unknown Source:0)  at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1764)  at android.os.Handler.dispatchMessage(Handler.java:105)  at android.os.Looper.loop(Looper.java:164)  at android.app.ActivityThread.main(ActivityThread.java:6938)  at java.lang.reflect.Method.invoke(Native Method)  at com.android.internal.os.Zygote$MethodAndArgsCaller.run(Zygote.java:327)  at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1374) 

like image 731
Mwikala Kangwa Avatar asked Nov 26 '22 20:11

Mwikala Kangwa


1 Answers

firebase-common looks for a particular string resource, "google_app_id", in FirebaseApp.initializeApp(Context) which in my case doesn't seem to exist.

(com.google.firebase:firebase-common@@16.0.4:301)
    StringResourceValueReader reader = new StringResourceValueReader(context);
    String applicationId = reader.getString("google_app_id");

I imagine this is supposed to be populated by google-services.json. Unsure of a solution at this time.

like image 110
Chris Watts Avatar answered Nov 29 '22 11:11

Chris Watts