firebase / FirebaseUI-Android

Optimized UI components for Firebase
https://firebaseopensource.com/projects/firebase/firebaseui-android/
Apache License 2.0
4.61k stars 1.83k forks source link

Problem with com.google.gms:google-services:4.1.0 #1445

Closed MacNakrub closed 5 years ago

MacNakrub commented 5 years ago

Step 1: Are you in the right place?

Maybe.

Step 2: Describe your environment

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
    }
}
samtstern commented 5 years ago

@MacNakrub there is a known issue where google-services 4.1.0 does not work with the latest versions of the Android Gradle Plugin (mostly 3.3.0-alpha0x). We are working on it!

Going to close this issue, we're tracking it elsewhere.

AndroidGecko commented 5 years ago

@samedson could you ref issue where this is being tracked, thanks!

samtstern commented 5 years ago

@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

kanetik commented 5 years ago

Can we get some indication of when we might see this fixed? Days, weeks, months?

eygraber commented 5 years ago

Now that 3.3 is in beta, can we get some more information about this? Very difficult to test out the alphas and betas (as the AS team suggests frequently) if Google's own tools don't work with them.

samtstern commented 5 years ago

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

johncodeos commented 5 years ago

This thing haven't been fixed yet? I want to update to 3.3 beta 3 because they have fixed the problem with the sound when you have open the emulator and you use bluetooth headphones.

samtstern commented 5 years ago

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

plastiv commented 5 years ago

@samtstern Where release notes could be found for 4.2.0?

Is it possible to add link to a changelog page here? https://developers.google.com/android/guides/google-services-plugin

kungufli commented 5 years ago

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

Pitel commented 5 years ago
> 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
danallen88 commented 5 years ago
> 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.

anton-klimov commented 5 years ago

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 :
mediadeo commented 5 years ago

for nativescripters using nativescript-plugin-firebase check https://github.com/EddyVerbruggen/nativescript-plugin-firebase/issues/1072

andresserranoglb commented 5 years ago

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

samtstern commented 5 years ago

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.

dluksza commented 5 years ago

I'm getting this error with google-services 4.2.0 and android gradle plugin 3.3.2

permadanis commented 5 years ago

its a typo on firebase documentation. the correct code is

com.google.gms.google-services.4.1.0

replace the colon : with dot .

lilfolr commented 5 years ago

I think mean it should be: classpath 'com.google.gms:google-services:4.1.0' Edit: Well that worked for me anyway :)

juliusMinimalist commented 4 years ago

Hi, I have the same issue even if I change version to classpath 'com.google.gms:google-services:4.1.0' Need Hepl plz ! image

webumer commented 4 years ago

Change this to classpath 'com.google.gms:google-services:4.3.2' work for me

bcamposq1995 commented 4 years ago

Android studio error: JAVA_LETTER_OR_DIGIT when changed to com.google.gms:google-services:4.3.2