I'm trying to register a user in firebase. Here is my code:
App level gradle:
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'
compile 'com.google.firebase:firebase-core:11.6.2'
compile 'com.google.firebase:firebase-auth:11.6.2'
}
Project level gradle:
dependencies {
classpath 'com.android.tools.build:gradle:3.0.1'
classpath 'com.google.gms:google-services:3.1.1' // google-services plugin
My code for register user:
private void registerUser(String name,String email,String password) {
pBar.setVisibility(View.VISIBLE);
mAuth.createUserWithEmailAndPassword(email,password).addOnCompleteListener(new OnCompleteListener<AuthResult>() {
#Override
public void onComplete(#NonNull Task<AuthResult> task) {
if(task.isSuccessful()){
Toast.makeText(getApplicationContext(),"User Created. Please login.",Toast.LENGTH_LONG).show();
}
else {
Toast.makeText(getApplicationContext(),task.getException().getMessage(),Toast.LENGTH_LONG).show();
}
pBar.setVisibility(View.GONE);
}
});
}
Here is the exception:
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 com.banik.helloworld.SignUpActivity.registerUser(SignUpActivity.java:73)
at com.banik.helloworld.SignUpActivity.onClick(SignUpActivity.java:68)
I have initialized mAuth in oncreate method of the activity:
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_sign_up);
mAuth = FirebaseAuth.getInstance();
name = findViewById(R.id.name);
email = findViewById(R.id.email);
mobileNumber = findViewById(R.id.mobilenumber);
password = findViewById(R.id.password);
signUpBtn = findViewById(R.id.signup);
signUpBtn.setOnClickListener(this);
pBar = findViewById(R.id.signupBar);
}
Please help me.......
You must have Google Play Services installed on your phone or emulator.
If you are testing it on the Emulator.
Try testing it on a real device or make sure you have GPS installed on your emulator and provides a correct longitude and latitude
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
App just opens and closes after running from android studio on android studio.
Following warning is also shown :
The app gradle file must have a dependency on com.google.firebase:firebase-core for Firebase services to work as intended.
I tried making making the app from a tutorial, the app is compiled successfully but just opens and closes when it is run on android phone.
build.gradle
apply plugin: 'com.android.application'
android {
compileSdkVersion 27
defaultConfig {
applicationId "com.example.hp.chatapp"
minSdkVersion 16
targetSdkVersion 27
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(dir: 'libs', include: ['*.jar'])
implementation 'com.android.support:appcompat-v7:27.1.1'
implementation 'com.android.support.constraint:constraint-layout:1.1.2'
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'
//add library
implementation 'com.android.support:design:27.1.1'
implementation 'com.firebaseui:firebase-ui-database:3.2.2'
implementation 'com.google.firebase:firebase-auth:10.2.1'
implementation 'com.firebaseui:firebase-ui-auth:3.2.2'
implementation "com.google.android.gms:play-services-gcm:10.2.1"
}
apply plugin: 'com.google.gms.google-services'
build.gradle
buildscript {
repositories {
google()
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.1.3'
classpath 'com.google.gms:google-services:4.0.2'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
Main activity is
public class MainActivity extends AppCompatActivity {
private static int SIGN_IN_REQUEST_CODE= 1;
private FirebaseListAdapter<ChatMessage> adapter;
RelativeLayout activity_main;
FloatingActionButton fab;
#Override
public boolean onOptionsItemSelected(MenuItem item) {
if(item.getItemId()==R.id.menu_sign_out){
AuthUI.getInstance().signOut(this).addOnCompleteListener(new
OnCompleteListener<Void>() {
#Override
public void onComplete(#NonNull Task<Void> task) {
Snackbar.make(activity_main,"You have been signed out.",Snackbar.LENGTH_SHORT).show();
finish();
}
});
}
return true;
}
#Override
public boolean onCreateOptionsMenu(Menu menu) {
getMenuInflater().inflate(R.menu.main_menu,menu);
return true;
}
#Override
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
super.onActivityResult(requestCode, resultCode, data);
if(requestCode==RESULT_OK){
Snackbar.make(activity_main,"Successfully signed in.Welcome !",Snackbar.LENGTH_SHORT).show();
displayChatMessage();
}
else {
Snackbar.make(activity_main,"We couldn't sign you in.Please try again later",Snackbar.LENGTH_SHORT).show();
finish();
}
}
#Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
activity_main=(RelativeLayout)findViewById(R.id.activity_main);
fab=(FloatingActionButton)findViewById(R.id.fab);
fab.setOnClickListener(new View.OnClickListener() {
#Override
public void onClick(View view) {
EditText input= (EditText)findViewById(R.id.input);
FirebaseDatabase.getInstance().getReference().push().setValue(new ChatMessage(input.getText().toString(),FirebaseAuth.getInstance().getCurrentUser().getEmail()));
input.setText("");
}
});
//check if not sign in then navigate signin page
if(FirebaseAuth.getInstance().getCurrentUser()==null)
{
startActivityForResult(AuthUI.getInstance().createSignInIntentBuilder().build(),SIGN_IN_REQUEST_CODE);
}
else {
Snackbar.make(activity_main,"Welcome "+FirebaseAuth.getInstance().getCurrentUser().getEmail(),Snackbar.LENGTH_SHORT).show();
}
//load content
displayChatMessage();
}
private void displayChatMessage() {
ListView listOfMessage=(ListView)findViewById(R.id.list_of_message);
//Suppose you want to retrieve "chats" in your Firebase DB:
Query query =
FirebaseDatabase.getInstance().getReference().child("chats");
//The error said the constructor expected FirebaseListOptions - here you create them:
FirebaseListOptions<ChatMessage> options = new FirebaseListOptions.Builder<ChatMessage>()
.setQuery(query, ChatMessage.class)
.setLayout(android.R.layout.simple_list_item_1)
.build();
//Finally you pass them to the constructor here:
adapter = new FirebaseListAdapter<ChatMessage>(options){
#Override
protected void populateView(View v, ChatMessage model, int position) {
// Get references to the views of message.xml
TextView messageText = (TextView)v.findViewById(R.id.message_text);
TextView messageTime = (TextView)v.findViewById(R.id.message_time);
TextView messageUser=(TextView)findViewById(R.id.message_user);
messageText.setText(model.getMessageText());
messageUser.setText(model.getMessageUser());
messageTime.setText(DateFormat.format("dd-MM-yyyy (HH:mm:ss)",model.getMessageTime()));
}
};
listOfMessage.setAdapter(adapter);
}
}
EDITED
log error from logcat
08-03 02:00:47.736 3199-3199/com.example.hp.chatapp E/HAL: PATH3 /odm/lib64/hw/gralloc.qcom.so
PATH2 /vendor/lib64/hw/gralloc.qcom.so
PATH1 /system/lib64/hw/gralloc.qcom.so
PATH3 /odm/lib64/hw/gralloc.msm8953.so
08-03 02:00:47.737 3199-3199/com.example.hp.chatapp E/HAL: PATH2 /vendor/lib64/hw/gralloc.msm8953.so
PATH1 /system/lib64/hw/gralloc.msm8953.so
Try using the Firebase tool within Android Studio. Select the service you want to integrate, and follow the step-by-step instructions.
Assuming all other setup is correct, the error is self explanatory. You need to add a dependency on Firebase Core in your app gradle file under dependencies:
implementation 'com.google.firebase:firebase-core:16.0.1'
You might also want to check out the link below for any missing steps.
Add Firebase to Android Project
I recently updated my firebase sdk version to the latest and all of a sudden the FirebaseAuth.signInWithEmailAndPassword() doesn't work anymore and it shows me this error:
W/Binder: Binder call failed.
com.google.android.gms.internal.firebase_auth.zzv: java.lang.NullPointerException: Attempt to invoke virtual method 'org.json.JSONObject com.google.firebase.auth.internal.zzm.zzbf()' on a null object reference
This is my code:
mAuth.signInWithEmailAndPassword(email.getText().toString(), password.getText().toString())
.addOnFailureListener(new OnFailureListener() {
#Override
public void onFailure(#NonNull Exception e) {
Log.v("trtrrt",e.toString());
}
}).addOnSuccessListener(new OnSuccessListener<AuthResult>() {
#Override
public void onSuccess(AuthResult authResult) {
Log.v("trtrrt","success");
}
});
The weird thing is when i enter a wrong email and password it calls the OnFailureListener, but if I enter a right email and password neither OnSuccessListener nor OnFailureListener get called.
Here is my current dependencies:
dependencies {
implementation 'com.mapbox.mapboxsdk:mapbox-android-sdk:5.5.1'
implementation 'com.mapbox.mapboxsdk:mapbox-android-navigation:0.12.0'
implementation 'com.mapbox.mapboxsdk:mapbox-android-navigation-ui:0.12.0'
implementation fileTree(dir: 'libs', include: ['*.jar'])
//noinspection GradleCompatible
implementation 'com.android.support:appcompat-v7:27.0.2'
implementation 'com.android.support.constraint:constraint-layout:1.0.2'
//noinspection GradleCompatible
implementation 'com.android.support:support-v4:27.0.2'
implementation 'com.google.android.gms:play-services-maps:15.0.0'
//noinspection GradleCompatible
implementation 'com.android.support:design:27.0.2'
//noinspection GradleCompatible
implementation 'com.android.support:support-vector-drawable:27.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'
implementation 'com.android.support:cardview-v7:26.1.0'
implementation 'com.google.android.gms:play-services-location:15.0.0'
implementation 'com.google.android.gms:play-services-places:15.0.0'
implementation 'com.google.firebase:firebase-core:15.0.2'
implementation 'com.google.firebase:firebase-database:15.0.0'
implementation 'com.google.firebase:firebase-crash:15.0.2'
implementation 'com.google.firebase:firebase-auth:15.1.0'
implementation 'com.google.firebase:firebase-messaging:15.0.2'
implementation 'com.google.firebase:firebase-storage:15.0.2'
implementation 'com.google.firebase:firebase-functions:15.0.0'
implementation 'com.simplify:simplify-android:3.0.0'
implementation 'com.android.volley:volley:1.1.0'
implementation 'com.google.android.gms:play-services-ads:15.0.0'
implementation 'com.android.support:multidex:1.0.1'
}
My problem wasn't because i didn't use
mAuth = FirebaseAuth.getInstance();
the sign in method was working fine before i upgraded the version of the Firebase SDK.
However, i solved the problem when i downgraded the firebase-auth dependence to:
implementation 'com.google.firebase:firebase-auth:15.0.0'
Please check this:
mAuth=FirebaseAuth.getInstace();
before calling signinWithEmailAndPass method on it.
mAuth = FirebaseAuth.getInstance();
on your btn login click call this method
private void loginUser(String email, String password) {
mAuth.signInWithEmailAndPassword(email,password).addOnCompleteListener(new OnCompleteListener<AuthResult>() {
#Override
public void onComplete(#NonNull Task<AuthResult> task) {
if (task.isSuccessful()){
mpProgressDialog.dismiss();
Intent intent = new Intent(LoginActivity.this,MainActivity.class);
intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK | Intent.FLAG_ACTIVITY_CLEAR_TASK);
startActivity(intent);
finish();
}else{
mpProgressDialog.hide();
Toast.makeText(LoginActivity.this,"Something error !!!",Toast.LENGTH_SHORT).show();
}
}
});
}
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