FirebaseUI-Android: Problem with com.google.gms:google-services:4.1.0

Step 1: Are you in the right place?

Maybe.

Step 2: Describe your environment

  • Android device: Emulator
  • Android OS version: O
  • Google Play Services version: 4.1.0
  • Firebase/Play Services SDK version:
    implementation 'com.google.firebase:firebase-core:16.0.3'
    implementation 'com.google.firebase:firebase-auth:16.0.3'
    implementation 'com.google.firebase:firebase-perf:16.1.0'
    implementation 'com.google.firebase:firebase-database:16.0.2'
    implementation 'com.google.firebase:firebase-firestore:17.1.0'
    implementation 'com.google.firebase:firebase-invites:16.0.3'
    implementation 'com.google.firebase:firebase-messaging:17.3.1'

    implementation 'com.google.android.gms:play-services-auth:16.0.0'
    implementation 'com.google.android.gms:play-services-maps:15.0.1'
    implementation 'com.google.android.gms:play-services-vision:15.0.2'
  • FirebaseUI version: both 4.1.0 and 4.2.0
   implementation "com.firebaseui:firebase-ui-auth:4.2.0"
   implementation "com.firebaseui:firebase-ui-storage:4.2.0"

Step 3: Describe the problem:

When change the version of com.google.gms:google-services from 4.0.x to 4.1.0

Steps to reproduce:

  1. Start app with google-services version 4.0.2. It’s working fine.
  2. Change google-services version 4.1.0, sync and run
  3. Crash
  4. Adding FirebaseApp.initializeApp(applicationContext) won’t help

Observed Results:

2018-09-13 17:49:12.515 27842-27842/xxx.xxxxxxx E/AndroidRuntime: FATAL EXCEPTION: main
    Process: xxx.xxxxxxx, PID: 27842
    java.lang.RuntimeException: Unable to create application xxx.xxxxxxx.MainApplication: java.lang.IllegalStateException: Default FirebaseApp is not initialized in this process xxx.xxxxxxx. Make sure to call FirebaseApp.initializeApp(Context) first.
        at android.app.ActivityThread.handleBindApplication(ActivityThread.java:5743)
        at android.app.ActivityThread.-wrap1(Unknown Source:0)
        at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1656)
        at android.os.Handler.dispatchMessage(Handler.java:106)
        at android.os.Looper.loop(Looper.java:164)
        at android.app.ActivityThread.main(ActivityThread.java:6494)
        at java.lang.reflect.Method.invoke(Native Method)
        at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:438)
        at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:807)
     Caused by: java.lang.IllegalStateException: Default FirebaseApp is not initialized in this process xxx.xxxxxxx. Make sure to call FirebaseApp.initializeApp(Context) first.
        at com.google.firebase.FirebaseApp.getInstance(com.google.firebase:firebase-common@@16.0.2:240)
        at com.google.firebase.firestore.FirebaseFirestore.getInstance(com.google.firebase:firebase-firestore@@17.0.5:49)
        at xxx.xxxxxxx.MainApplication.onCreate(MainApplication.kt:57)
        at android.app.Instrumentation.callApplicationOnCreate(Instrumentation.java:1119)
        at android.app.ActivityThread.handleBindApplication(ActivityThread.java:5740)
        at android.app.ActivityThread.-wrap1(Unknown Source:0) 
        at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1656) 
        at android.os.Handler.dispatchMessage(Handler.java:106) 
        at android.os.Looper.loop(Looper.java:164) 
        at android.app.ActivityThread.main(ActivityThread.java:6494) 
        at java.lang.reflect.Method.invoke(Native Method) 
        at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:438) 
        at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:807) 

Expected Results:

App won’t crash and start normally

Relevant Code:

class MainApplication : Application() {
override fun onCreate() {
      super.onCreate()
     ...

     // Adding `FirebaseApp.initializeApp(applicationContext)` here won't help
      val settings = FirebaseFirestoreSettings.Builder()
              .setTimestampsInSnapshotsEnabled(true)
              .build()
      val firestore = FirebaseFirestore.getInstance()
      firestore.firestoreSettings = settings
  }
}

About this issue

  • Original URL
  • State: closed
  • Created 6 years ago
  • Comments: 22 (5 by maintainers)

Most upvoted comments

The same issue for 4.1.0 and 4.2.0. It worked today. But now it isn’t. I can’t download any version

> Could not resolve all artifacts for configuration ':classpath'.
   > Could not find com.google.gms:google-services:4.1.0.
     Searched in the following locations:
       - https://dl.google.com/dl/android/maven2/com/google/gms/google-services/4.1.0/google-services-4.1.0.pom
       - https://dl.google.com/dl/android/maven2/com/google/gms/google-services/4.1.0/google-services-4.1.0.jar
       - https://jcenter.bintray.com/com/google/gms/google-services/4.1.0/google-services-4.1.0.pom
       - https://jcenter.bintray.com/com/google/gms/google-services/4.1.0/google-services-4.1.0.jar
       - https://maven.fabric.io/public/com/google/gms/google-services/4.1.0/google-services-4.1.0.pom
       - https://maven.fabric.io/public/com/google/gms/google-services/4.1.0/google-services-4.1.0.jar
       - https://plugins.gradle.org/m2/com/google/gms/google-services/4.1.0/google-services-4.1.0.pom
       - https://plugins.gradle.org/m2/com/google/gms/google-services/4.1.0/google-services-4.1.0.jar
     Required by:
         project :
> Could not resolve all artifacts for configuration ':classpath'.
   > Could not find com.google.gms:google-services:4.2.0.
     Searched in the following locations:
       - https://dl.google.com/dl/android/maven2/com/google/gms/google-services/4.2.0/google-services-4.2.0.pom
       - https://dl.google.com/dl/android/maven2/com/google/gms/google-services/4.2.0/google-services-4.2.0.jar
       - https://jcenter.bintray.com/com/google/gms/google-services/4.2.0/google-services-4.2.0.pom
       - https://jcenter.bintray.com/com/google/gms/google-services/4.2.0/google-services-4.2.0.jar
       - https://maven.fabric.io/public/com/google/gms/google-services/4.2.0/google-services-4.2.0.pom
       - https://maven.fabric.io/public/com/google/gms/google-services/4.2.0/google-services-4.2.0.jar
> Could not resolve all artifacts for configuration ':classpath'.
   > Could not find com.google.gms:google-services:4.2.0.
     Searched in the following locations:
       - https://dl.google.com/dl/android/maven2/com/google/gms/google-services/4.2.0/google-services-4.2.0.pom
       - https://dl.google.com/dl/android/maven2/com/google/gms/google-services/4.2.0/google-services-4.2.0.jar
       - https://jcenter.bintray.com/com/google/gms/google-services/4.2.0/google-services-4.2.0.pom
       - https://jcenter.bintray.com/com/google/gms/google-services/4.2.0/google-services-4.2.0.jar
       - https://maven.fabric.io/public/com/google/gms/google-services/4.2.0/google-services-4.2.0.pom
       - https://maven.fabric.io/public/com/google/gms/google-services/4.2.0/google-services-4.2.0.jar

Seeing the same for 4.1.0.

Hey all there’s an ongoing issue with the Google Maven repo (google() or maven.google.com) so if you’re having trouble with your dependencies today, that’s the reason. It doesn’t have anything to do with FirebaseUI so please refrain from adding more comments here.

Sorry I don’t have a timeline yet, please keep using google-services:4.0.1 for now

Hi @MacNakrub @danallen88 and @Pitel I was getting the same issue, according to the documentation (https://mvnrepository.com/artifact/com.google.gms/google-services/4.2.0) the artifact is located on https://dl.bintray.com/android/android-tools/ so I added to the build.gradle maven { url ‘https://dl.bintray.com/android/android-tools’ } and now it`s working well

com.google.gms:google-services:4.2.0 works as expected, thanks.

Have you tried version 4.2.0 of the google-services plugin?

@AndroidGecko it’s being tracked internally, so if I gave you a link it wouldn’t work for you … sorry for the lack of transparency