So, I had implemented GCM in my app and now I am trying to migrate my app to FCM. After following all the steps, I started to see I/FirebaseInitProvider: FirebaseApp initialization unsuccessful
I have been wrecking my head against it all day long and have followed everything I could find on stackoverflow and finally decided to put the question. (I have verified here and some more in similar questions)
Here is my gradle file:
buildscript {
repositories {
maven { url 'https://maven.fabric.io/public' }
mavenCentral()
}
dependencies {
classpath 'io.fabric.tools:gradle:1.+'
classpath 'com.android.tools.build:gradle:2.1.2'
classpath 'com.google.gms:google-services:3.0.0'
}
}
apply plugin: 'com.android.application'
apply plugin: 'io.fabric'
repositories {
maven { url 'https://maven.fabric.io/public' }
mavenCentral()
jcenter()
flatDir {
dirs 'libs'
}
}
android {
compileSdkVersion 23
buildToolsVersion '23.0.3'
defaultConfig {
applicationId "com.my.app"
minSdkVersion 15
targetSdkVersion 23
versionCode 33
versionName "3.1.0"
renderscriptTargetApi 19
renderscriptSupportModeEnabled true
}
buildTypes {
release {
minifyEnabled true
shrinkResources true
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
applicationVariants.all { variant ->
variant.outputs.each { output ->
output.outputFile = new File(
output.outputFile.parent,
output.outputFile.name.replace(".apk", "-${variant.versionCode}-${variant.versionName}.apk"))
}
}
packagingOptions {
exclude 'META-INF/LICENSE'
exclude 'META-INF/LICENSE-FIREBASE.txt'
exclude 'META-INF/NOTICE'
}
sourceSets { main { assets.srcDirs = ['src/main/assets', 'src/main/assets/fonts'] } }
}
dependencies {
compile fileTree(include: ['*.jar'], dir: 'libs')
compile 'com.android.support:appcompat-v7:23.4.0'
compile 'com.android.support:recyclerview-v7:23.4.0'
compile 'com.google.android.gms:play-services-base:9.2.0'
compile 'com.google.android.gms:play-services-plus:9.2.0'
compile 'com.google.android.gms:play-services-analytics:9.2.0'
compile 'com.google.android.gms:play-services-appindexing:9.2.0'
compile 'com.google.android.gms:play-services-identity:9.2.0'
compile 'com.google.android.gms:play-services-location:9.2.0'
compile 'com.google.firebase:firebase-core:9.2.0'
compile 'com.google.firebase:firebase-messaging:9.2.0'
...
}
apply plugin: 'com.google.gms.google-services'
My Directory Structure:
Main Folder
->gradle
->build
->app
--->google-services.json
->custom
--->src
--->build
--->google-services.json
--->all the files pertaining to application
Both the google-services.json are same the json file contains the SHA1 values as well (set up in firebase console).
Migration followed from: https://developers.google.com/cloud-messaging/android/android-migrate-fcm
Any help is very appreciated as I just haven't been able to find a solution.
EDIT:
Adding project level build.gradle file:
// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
repositories {
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:2.1.2'
classpath 'com.google.gms:google-services:3.0.0'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
allprojects {
repositories {
jcenter()
}
}