I've been trying to add Firebase cloud messaging to my app but can't get pass this issue. Whenever I include firebase messaging in my android>app>build.gradle, my app launches but the immediately closes then just hangs on "Installing build\app\outputs\apk\app.apk":
implementation 'com.google.firebase:firebase-messaging:20.1.6'
android>app>build.gradle:
dependencies {
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
testImplementation 'junit:junit:4.12'
implementation 'com.google.firebase:firebase-core:16.0.1'
androidTestImplementation 'androidx.test:runner:1.1.1'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.1.1'
//implementation 'com.google.firebase:firebase-analytics:17.2.2'
implementation 'com.google.firebase:firebase-messaging:20.1.6'
}
apply plugin: 'com.google.gms.google-services'
android>build.gradle:
dependencies {
classpath 'com.android.tools.build:gradle:3.6.1'
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
classpath 'com.google.gms:google-services:4.2.0'
}
I'm not sure whether this is a versioning issue?
Regarding to release notes
The Firebase Android library firebase-core is no longer needed. This
SDK included the Firebase SDK for Google Analytics.
https://firebase.google.com/support/release-notes/android
Also, use google play service plugin version 4.3.3
classpath com.google.gms:google-services:4.3.3
Your could use bom(Bill Of Material) of firebase like this:
implementation platform('com.google.firebase:firebase-bom:27.1.0')
implementation 'com.google.firebase:firebase-core'
implementation 'com.google.firebase:firebase-analytics'
implementation 'com.google.firebase:firebase-messaging'
then to import (in your activity):
import com.google.android.gms.tasks.OnFailureListener;
import com.google.android.gms.tasks.OnSuccessListener;
import com.google.firebase.messaging.FirebaseMessaging;
.
.
#Override
protected void attachBaseContext(Context newBase) {
FirebaseMessaging.getInstance().subscribeToTopic("all").addOnSuccessListener(new OnSuccessListener<Void>() {
#Override
public void onSuccess(Void aVoid) {
Log.e("my_tag", "successfully register in topic");
}
}).addOnFailureListener(new OnFailureListener() {
#Override
public void onFailure(#NonNull Exception e) {
Log.e("my_tag", e.getMessage());
}
});
}
Related
I'm working on a mobile application using android and Firebase from a while but only now i encounter some problems as you can see here
I/BiChannelGoogleApi: [FirebaseAuth: ] getGoogleApiForMethod() returned Gms:com.google.firebase.auth.api.internal.zzaq#f3584ed
In addition, keep in mind already add users when i testing the app and i verified the e-mail and password as you can see :
here is my app gradle:
apply plugin: 'com.android.application'
apply plugin: 'com.google.gms.google-services'
/...
dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation 'androidx.appcompat:appcompat:1.1.0'
implementation 'com.google.android.material:material:1.2.0-alpha06'
implementation 'androidx.constraintlayout:constraintlayout:1.1.3'
implementation 'com.google.firebase:firebase-auth:19.3.0'
testImplementation 'junit:junit:4.12'
androidTestImplementation 'androidx.test.ext:junit:1.1.1'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.2.0'
//firebase
implementation 'com.google.firebase:firebase-analytics:17.3.0'
implementation 'com.google.firebase:firebase-auth:19.3.0'
implementation files('libs/ojdbc14.jar')
implementation 'com.google.code.gson:gson:2.8.6'
implementation 'org.springframework.android:spring-android-rest-template:2.0.0.M1'
implementation 'com.fasterxml.jackson.core:jackson-databind:2.4.1.3'
}
project gradle:
buildscript {
repositories {
google()
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.6.1'
classpath 'com.google.gms:google-services:4.3.3'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
my problem is when i sign in with registred and verified user, here is my sign in function:
private void verifyLogin(View view) {
if ( !ValidatePassword() || !ValidateEmail()){
return;
}
final FirebaseAuth firebaseAuth = FirebaseAuth.getInstance();
String email= login_email_field.getText().toString();
String password= login_password_field.getText().toString();
Log.d("password", password);
Log.d("email", email);
firebaseAuth.signInWithEmailAndPassword(email,password).addOnCompleteListener(new OnCompleteListener<AuthResult>() {
#Override
public void onComplete(#NonNull Task<AuthResult> task) {
if (task.isSuccessful()){
if (firebaseAuth.getCurrentUser().isEmailVerified()){
Intent intent = new Intent(getApplicationContext(), PublicHomeActivity.class);
intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK | Intent.FLAG_ACTIVITY_CLEAR_TASK);
startActivity(intent);
}
}
}
});
}
I'm Trying to read data from Firebase but app crashes on generate error in logcat below. I have tried all solutions available on stackoverflow and other sites but still i m failed to solve this issue I have made changes and shared necessary code here
.gradle Project (dependencies)
dependencies {
classpath 'com.android.tools.build:gradle:3.3.2'
classpath 'com.google.gms:google-services:4.2.0'
}
app.gradle (dependencies)
dependencies {
implementation fileTree(include: ['*.jar'], dir: 'libs')
implementation 'com.android.support:appcompat-v7:28.0.0'
implementation 'com.android.support:animated-vector-drawable:28.0.0'
implementation 'com.android.support.constraint:constraint-layout:1.1.3'
implementation 'com.google.firebase:firebase-database:17.0.0'
implementation 'com.google.firebase:firebase-core:16.0.9'
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'
implementation 'com.android.support:support-annotations:28.0.0'
implementation 'com.android.support:support-v4:28.0.0'
}
main.java
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
FirebaseApp.initializeApp(getApplicationContext());
initViews();
mBtn.setOnClickListener(this::readData);
}
public void readData(View view) {
mRef.addValueEventListener(new ValueEventListener() {
#Override
public void onDataChange(#NonNull DataSnapshot dataSnapshot) {
String data = dataSnapshot.getValue(String.class);
setT.setText(data);
}
#Override
public void onCancelled(#NonNull DatabaseError databaseError) {
setT.setText("Sorry Data");
}
});
}
private void initViews() {
mBtn = findViewById(R.id.mBtn);
setT = findViewById(R.id.setT);
}
}
Logcat
try replace your database implementation version 17.0.0 to this version
implementation 'com.google.firebase:firebase-database:16.0.5'
and it will work
i'm creating simple library which make call to weather api, in my lib-project i use RxJava and RxAndroid and retrofit for http calls.
My WeatherService make the call and receive result as json and need to make some manipulations and return it as Single<CurrentWeather> to the client app.
In my lib-project i add to gradle all needed dependencies for rx and retrofit.
My library gradle:
ext{
rxJava = "2.1.17"
rxAndroid = "2.0.2"
support = "27.1.1"
retrofitVersion = "2.4.0"
}
dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation "com.android.support:appcompat-v7:$support"
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'
implementation "com.squareup.retrofit2:retrofit:$retrofitVersion"
implementation "com.squareup.retrofit2:converter-gson:$retrofitVersion"
implementation "com.squareup.retrofit2:adapter-rxjava2:$retrofitVersion"
implementation "io.reactivex.rxjava2:rxandroid:$rxAndroid"
implementation "io.reactivex.rxjava2:rxjava:$rxJava"
}
Now in my sample app in MainActivity i wanted to test one function to see if it works as expected, but when i try call the function which return Single it show comlpile error:
error: cannot access Single
class file for io.reactivex.Single not found
lib function declaration:
public Single<Current> getCurrentWeather(double lat, double lng) {
return mClient.getWeather(lat + "," + lng).flatMap(new Function<JSONObject, SingleSource<Current>>() {
#Override
public SingleSource<Current> apply(JSONObject jsonObject) throws Exception {
//parse jsonObject and return as Single<Current>
return Single.create(new SingleOnSubscribe<Current>() {
#Override
public void subscribe(SingleEmitter<Current> emitter) throws Exception {
Current current = new Current();
emitter.onSuccess(current);
}
});
}
});
}
Client app MainActivity: Here i have the compile error.
WeatherService.getIsnstance().getCurrentWeather(32.5554, 35.545)
Client app gradle:
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.3'
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'
implementation project(":weatherlib")
}
Client app settings.gradle:
include ':app', ':weatherlib'
Do i miss something here ?
Do this means that everyone who will wish to use this lib will have to add rx dependencies in their gradle too?
You need to use api instead of implementation for your library's dependencies.
See here for the difference between them.
I am trying to integrate Pinterest for sharing blog/creating a pin. I am following the official documentation, tutorial1 and tutorial2 to integrate the Pinterest.
But, the issue is when I try to authorize the user and pass PDKCallback object into the login method as shown below,
pdkClient.login(this, scopes, new PDKCallback() {
#Override
public void onSuccess(PDKResponse response) {
Log.d(getClass().getName(), response.getData().toString());
//user logged in, use response.getUser() to get PDKUser object
}
#Override
public void onFailure(PDKException exception) {
Log.e(getClass().getName(), exception.getDetailMessage());
}
});
It shows me the following compilation error
cannot access Response class file for com.android.volley.Response not found
Can anybody help me with this problem?
Edit
My pdk module gradle file is as follows:
apply plugin: 'com.android.library'
android {
compileSdkVersion 21
buildToolsVersion '27.0.3'
defaultConfig {
minSdkVersion 11
targetSdkVersion 21
versionCode 1
versionName "1.0"
}
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:21.0.3'
implementation 'com.android.volley:volley:1.1.1'
// implementation 'com.mcxiaoke.volley:library:1.0.19'
}
My app module build.gradle file's dependency is as follows
dependencies {
implementation('com.crashlytics.sdk.android:crashlytics:2.5.2#aar')
{
transitive = true
}
implementation 'com.android.support:appcompat-v7:27.1.1'
implementation 'com.android.support:cardview-v7:27.1.1'
implementation 'com.google.code.gson:gson:2.8.4'
implementation 'com.squareup.retrofit2:retrofit:2.3.0'
implementation 'com.squareup.retrofit2:converter-gson:2.3.0'
implementation 'com.android.support:multidex:1.0.3'
implementation 'com.firebase:firebase-client-android:2.4.0'
implementation 'com.plattysoft.leonids:LeonidsLib:1.3.1'
implementation 'com.google.firebase:firebase-database:16.0.1'
implementation project(':wScratchViewLibrary')
implementation project(':linkedin-sdk')
implementation project(':pdk')
implementation 'com.google.firebase:firebase-core:16.0.1'
implementation 'com.google.firebase:firebase-messaging:17.3.0'
implementation 'com.google.firebase:firebase-auth:16.0.1'
implementation 'com.android.support:support-v4:27.1.1'
implementation 'com.android.support:design:27.1.1'
implementation 'com.j256.ormlite:ormlite-android:4.48'
implementation 'com.j256.ormlite:ormlite-core:4.48'
implementation 'com.android.support:recyclerview-v7:27.1.1'
implementation 'com.google.android.gms:play-services-vision:15.0.2'
implementation 'com.google.android.gms:play-services-auth:16.0.0'
implementation 'com.google.android.gms:play-services-plus:15.0.1'
implementation 'com.facebook.android:facebook-share:4.33.0'
implementation ('com.twitter.sdk.android:twitter:3.3.0#aar') {
transitive = true
}
implementation 'com.android.support.constraint:constraint-layout:1.1.3'
implementation 'com.github.amlcurran.showcaseview:library:5.4.3'
implementation "com.mixpanel.android:mixpanel-android:5.4.1"
implementation "com.google.android.gms:play-services-gcm:15.0.1"
implementation 'com.github.bumptech.glide:glide:4.8.0'
annotationProcessor 'com.github.bumptech.glide:compiler:4.8.0'
implementation 'com.wang.avi:library:2.1.3'
testImplementation 'junit:junit:4.12'
androidTestImplementation 'com.jayway.android.robotium:robotium-solo:5.6.0'
androidTestImplementation 'com.android.support.test:rules:1.0.2'
implementation files('libs/nineoldandroids-library-2.4.0.jar')
implementation 'com.github.PhilJay:MPAndroidChart:v3.0.3'
implementation 'com.github.cooltechworks:ScratchView:v1.1'
}
My PinterestApi class from which I try to access the login method of pdk.
package com.veriloginqr.android.sharing_apis;
import android.content.Context;
import android.util.Log;
import com.pinterest.android.pdk.PDKCallback;
import com.pinterest.android.pdk.PDKClient;
import com.pinterest.android.pdk.PDKException;
import com.pinterest.android.pdk.PDKResponse;
import java.util.ArrayList;
import java.util.List;
public class PinterestApi {
private static final String appID = "my_app_id_i_wont_reveal";
private PDKClient pdkClient;
private Context context;
public PinterestApi(Context context) {
this.context=context;
// Call configureInstance() method with context and App Id
pdkClient = PDKClient.configureInstance(context, appID);
// Call onConnect() method to make link between App id and Pinterest SDK
pdkClient.onConnect(context);
PDKClient.setDebugMode(true);
}
public void authorizeUser(){
List<String> scopes = new ArrayList<>();
scopes.add(PDKClient.PDKCLIENT_PERMISSION_READ_PUBLIC);
scopes.add(PDKClient.PDKCLIENT_PERMISSION_WRITE_PUBLIC);
pdkClient.login(context,scopes,new PDKCallback(){
#Override
public void onSuccess(PDKResponse response) {
Log.d(getClass().getName(), response.getData().toString());
//user logged in, use response.getUser() to get PDKUser object
}
#Override
public void onFailure(PDKException exception) {
Log.e(getClass().getName(), exception.getDetailMessage());
}
});
}
}
Note: You can check the pdk source code here.
try changing the volley version from 1.0.0 to 1.0.1 like this
implementation 'com.android.volley:volley:1.1.1'
or I think you should be adding volley in your app’s build.gradle
Imports & codes seems fine. The issue seems to be not downloading the whole dependency nor, there was a problem when building which needs a rebuild-clean project.
The solution will be using the latest version:
implementation 'com.android.volley:volley:1.1.1'
And making sure offline work not checked in the Settings.
I was doing this tutorial on Android and Firebase but for some reason when I try to register a new driver it doesn't interact with Firebase at all. Though it does show it's connected to Firebase:
I have downgraded my API to 26 because of this error:
Google Play services out of date. Requires 9256000 but found 9080470.
So I installed Genymotion to solve this issue as advised by contributors on this platform.
But it still doesn't communicate with Firebase. It returns 0 Errors and yet doesn't work.
I've installed GenyMotion but every time I try to run on it's devices it keeps crashing.
public class DriverLoginActivity extends AppCompatActivity {
private EditText mEmail, mPassword;
private Button mLogin, mRegistration;
private FirebaseAuth mAuth;
private FirebaseAuth.AuthStateListener firebaseAuthListener;
private static final String TAG = "Test";
#Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_driver_login);
mAuth = FirebaseAuth.getInstance();
firebaseAuthListener = new FirebaseAuth.AuthStateListener() {
#Override
public void onAuthStateChanged(#NonNull FirebaseAuth firebaseAuth) {
FirebaseUser user = FirebaseAuth.getInstance().getCurrentUser();
if(user!=null){
Intent intent = new Intent(DriverLoginActivity.this,
MainActivity.class);
startActivity(intent);
finish();
return;
}
}
};
mEmail = findViewById(R.id.email);
mPassword = findViewById(R.id.password);
mLogin = findViewById(R.id.login);
mRegistration = findViewById(R.id.registration);
mRegistration.setOnClickListener(new View.OnClickListener() {
#Override
public void onClick(View view) {
final String email = mEmail.getText().toString();
final String password = mPassword.getText().toString();
mAuth.createUserWithEmailAndPassword(email,
password).addOnCompleteListener(DriverLoginActivity.this, new
OnCompleteListener<AuthResult>() {
#Override
public void onComplete(#NonNull Task<AuthResult> task) {
if(!task.isSuccessful()){
Toast.makeText(DriverLoginActivity.this, "sign up
error", Toast.LENGTH_SHORT).show();
}else {
String user_id = mAuth.getCurrentUser().getUid();
DatabaseReference current_user_db =
FirebaseDatabase.getInstance().getReference().child("Users").child("Drivers").child(user_id);
current_user_db.setValue(true);
}
}
});
}
});
mLogin.setOnClickListener(new View.OnClickListener() {
#Override
public void onClick(View view) {
final String email = mEmail.getText().toString();
final String password = mPassword.getText().toString();
mAuth.signInWithEmailAndPassword(email, password).addOnCompleteListener(DriverLoginActivity.this, new OnCompleteListener<AuthResult>() {
#Override
public void onComplete(#NonNull Task<AuthResult> task) {
Log.d(TAG, "createUserWithEmail:onComplete:" + task.isSuccessful());
if(!task.isSuccessful()){
Log.d(TAG, "onComplete: Failed=" + task.getException().getMessage());
Toast.makeText(DriverLoginActivity.this, "sign up error", Toast.LENGTH_SHORT).show();
}
}
});
}
});
}
#Override
protected void onStart() {
super.onStart();
mAuth.addAuthStateListener(firebaseAuthListener);
}
#Override
protected void onStop() {
super.onStop();
mAuth.removeAuthStateListener(firebaseAuthListener);
}
}
Here are my build.gradle (app)
apply plugin: 'com.android.application'
android {
compileSdkVersion 26
defaultConfig {
applicationId "ke.co.wafalmelogistics.wafalme"
minSdkVersion 17
targetSdkVersion 26
versionCode 1
versionName "1.0"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
implementation fileTree(include: ['*.jar'], dir: 'libs')
implementation 'com.android.support:appcompat-v7:26.1.0'
implementation 'com.android.support.constraint:constraint-layout:1.0.2'
implementation 'com.google.gms:google-services:3.1.0'
implementation 'com.google.firebase:firebase-core:11.6.0'
implementation 'com.google.firebase:firebase-database:11.6.0'
implementation 'com.google.firebase:firebase-auth:11.6.0'
testImplementation 'junit:junit:4.12'
androidTestImplementation 'com.android.support.test:runner:1.0.1'
androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.1'
}
apply plugin: 'com.google.gms.google-services'
build.gradle (module)
// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
repositories {
google()
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.0.0'
classpath 'com.google.gms:google-services:3.1.0'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
allprojects {
repositories {
google()
jcenter()
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}
And here is the Error I keep getting when I try to run the app on GenyMotion;
--------- beginning of crash
E/AndroidRuntime: FATAL EXCEPTION: main
Process: ke.co.wafalmelogistics.wafalme, PID: 1640
java.lang.NullPointerException: Attempt to invoke virtual method 'com.google.android.gms.tasks.Task com.google.android.gms.common.api.GoogleApi.zzb(com.google.android.gms.common.api.internal.zzdf)' on a null object reference
at com.google.android.gms.internal.zzdtp.zzb(Unknown Source)
at com.google.android.gms.internal.zzdtw.zza(Unknown Source)
at com.google.firebase.auth.FirebaseAuth.createUserWithEmailAndPassword(Unknown Source)
at ke.co.wafalmelogistics.wafalme.DriverLoginActivity$2.onClick(DriverLoginActivity.java:61)
at android.view.View.performClick(View.java:5637)
at android.view.View$PerformClick.run(View.java:22429)
at android.os.Handler.handleCallback(Handler.java:751)
at android.os.Handler.dispatchMessage(Handler.java:95)
at android.os.Looper.loop(Looper.java:154)
at android.app.ActivityThread.main(ActivityThread.java:6119)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:886)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:776)
ItI am a learner, any help is appreciated.
I get the same error because I was use Emulator ..
but when I try it in a real device it is working perfectly ..
Hope it works for you too..
Worked for me using these dependencies:
dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation 'com.android.support:appcompat-v7:26.1.0'
implementation 'com.android.support.constraint:constraint-layout:1.0.2'
testImplementation 'junit:junit:4.12'
androidTestImplementation 'com.android.support.test:runner:1.0.1'
androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.1'
//NOT DEFAULT BELOW
compile 'com.firebase:firebase-client-android:2.3.1'
compile 'com.android.support:design:26.1.0'
compile 'com.github.rtoshiro.mflibrary:mflibrary:1.0.0'
compile 'com.google.firebase:firebase-core:11.2.0'
compile 'com.google.firebase:firebase-database:11.2.0'
compile 'com.google.firebase:firebase-auth:11.2.0'
}
Thank you for all the help.
I have the same problem when I use 'com.google.firebase:firebase-auth:11.6.0'
change to 'com.google.firebase:firebase-auth:11.2.0'
`
Try this dependencies:
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation 'com.android.support:appcompat-v7:26.1.0'
implementation 'com.android.support.constraint:constraint-layout:1.0.2'
compile 'com.firebase:firebase-client-android:2.3.1'
compile 'com.google.firebase:firebase-database:11.2.0'
compile 'com.google.firebase:firebase-crash:11.2.0'
compile 'com.google.firebase:firebase-auth:11.2.0'
compile 'com.google.firebase:firebase-messaging:11.2.0'
testImplementation 'junit:junit:4.12'
androidTestImplementation 'com.android.support.test:runner:1.0.1'
androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.1'
had the same issue in my project while running in the emulator but I solved this by using this in Android Studio 3.0.1
app/build.gradle
compile "com.google.firebase:firebase-auth:9.0.2"
build.gradle ( root directory )
classpath 'com.google.gms:google-services:3.0.0'
there setting work for me
Looking at https://github.com/firebase/FirebaseUI-Android/issues/1104. I think this is an acknowledged issue in the SDK that would be resolved in the next 1 or 2 SDK updates. A github user called Samstern posts this -
A fix for this bug has been submitted internally, so this should be
fixed in the next 1-2 Firebase Auth SDK releases depending on the
release cycle.
I am going to close this issue here since there's nothing more
FIrebaseUI can do, thanks for everyone who reported it!
Nonetheless, try the following and see if it works. To repeat what Bob Snyder said - Delete this line from the dependencies block: implementation 'com.google.gms:google-services:3.1.0'. Upgrade your firebase to 11.8.0. So your app's build.gradle should look like something like this.
implementation 'com.google.firebase:firebase-core:11.8.0'
implementation 'com.google.firebase:firebase-auth:11.8.0'
implementation 'com.google.firebase:firebase-messaging:11.8.0'
implementation 'com.google.firebase:firebase-storage:11.8.0'
implementation 'com.google.firebase:firebase-database:11.8.0'
Let me know how that goes.
I solved this by upgrading Google Play Services in the emulator. It was not necessary to change anything in gradle.
For me works change from compile:
com.google.firebase:firebase-auth:11.8.0
to compile:
com.google.firebase:firebase-auth:11.2.0