Cannot resolve symbol 'FirebaseInstanceId' Android - android

I started to encounter this error when I upgraded the version of the project to androidx. I also upgraded the firebase sdks. I started getting error "Cannot resolve symbol 'FirebaseInstanceId' " . With this method, I was taking the user's token and printing it to the database. How can I solve this problem?
Manifest :
<service
android:name=".MyFirebaseIdService"
android:enabled="true"
android:exported="true">
<intent-filter>
<action android:name="com.google.firebase.INSTANCE_ID_SERVICE" />
</intent-filter>
MyFirebaseIdService;
import com.google.firebase.auth.FirebaseAuth;
import com.google.firebase.auth.FirebaseUser;
import com.google.firebase.database.DatabaseReference;
import com.google.firebase.database.FirebaseDatabase;
import com.google.firebase.iid.FirebaseInstanceId;
import com.google.firebase.iid.FirebaseInstanceIdService;
public class MyFirebaseIdService extends FirebaseInstanceIdService {
#Override
public void onTokenRefresh() {
super.onTokenRefresh();
FirebaseUser firebaseUser = FirebaseAuth.getInstance().getCurrentUser();
String refreshToken = FirebaseInstanceId.getInstance().getToken();
if (firebaseUser != null){
updateToken(refreshToken);
}
}
private void updateToken(String refreshToken) {
FirebaseUser firebaseUser = FirebaseAuth.getInstance().getCurrentUser();
DatabaseReference reference = FirebaseDatabase.getInstance().getReference("Tokens");
Token token = new Token(refreshToken);
reference.child(firebaseUser.getUid()).setValue(token);
}
}
Token ( model class ):
public class Token {
private String token;
public Token(String token) {
this.token = token;
}
public Token() {
}
public String getToken() {
return token;
}
public void setToken(String token) {
this.token = token;
}
}
I was rewriting the token code every time the user entered the home page.
MainActiviy :
updateToken(FirebaseInstanceId.getInstance().getToken());
private void updateToken(String token){
DatabaseReference reference = FirebaseDatabase.getInstance().getReference("Tokens");
Token token1 = new Token(token);
reference.child(fuser.getUid()).setValue(token1);
}
build.gradle ( project )
buildscript {
repositories {
google()
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:7.1.2'
classpath 'com.google.gms:google-services:4.3.10'
classpath 'com.google.firebase:firebase-crashlytics-gradle:2.5.2'
}
}
allprojects {
repositories {
google()
jcenter()
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}
build.gradle ( module )
apply plugin: 'com.android.application'
apply plugin: 'com.google.gms.google-services'
apply plugin: 'com.google.firebase.crashlytics'
android {
compileSdkVersion 30
defaultConfig {
applicationId "***"
minSdkVersion 19
targetSdkVersion 30
versionCode 21
versionName "1.1.9"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
multiDexEnabled true
}
lintOptions {
checkReleaseBuilds false
abortOnError false
}
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:28.0.0'
implementation 'com.android.support:design:28.0.0'
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 'com.firebaseui:firebase-ui-database:4.0.1'
implementation 'com.google.firebase:firebase-database:16.0.1'
implementation 'com.google.firebase:firebase-storage:16.0.1'
implementation 'com.android.support:cardview-v7:28.0.0'
implementation 'com.android.support:recyclerview-v7:28.0.0'
implementation 'com.android.support:design:28.0.0'
implementation 'com.github.orangegangsters:swipy:1.2.3#aar'
implementation 'de.hdodenhof:circleimageview:2.2.0'
implementation 'com.theartofdev.edmodo:android-image-cropper:2.7.+'
implementation 'com.squareup.picasso:picasso:2.5.2'
implementation 'com.google.firebase:firebase-storage:16.0.1'
implementation 'com.firebaseui:firebase-ui-database:4.0.1'
implementation 'com.android.support.constraint:constraint-layout:1.1.3'
implementation 'com.google.firebase:firebase-inappmessaging-display:17.0.1'
implementation 'com.android.support:multidex:1.0.3'
implementation 'com.google.android.gms:play-services-ads:15.0.1'
implementation('com.google.apis:google-api-services-people:v1-rev2-1.21.0')
{
exclude module: 'guava-jdk5'
}
implementation 'com.squareup.retrofit2:retrofit:2.3.0'
implementation 'com.squareup.retrofit2:converter-gson:2.3.0'
implementation 'com.google.firebase:firebase-ads:15.0.1'
implementation "io.grpc:grpc-okhttp:1.32.2"
implementation 'com.android.billingclient:billing:3.0.0'
implementation platform('com.google.firebase:firebase-bom:29.3.0')
implementation 'com.google.firebase:firebase-crashlytics'
implementation 'com.google.firebase:firebase-analytics'
implementation 'com.google.firebase:firebase-core:20.1.2'
implementation 'com.google.firebase:firebase-messaging:23.0.2'
implementation 'com.google.firebase:firebase-auth:21.0.3'
}
apply plugin: 'com.google.gms.google-services'
----- UPDATE ---- SOLUTÄ°ON :
FirebaseMessaging.getInstance ().getToken ()
.addOnCompleteListener ( task -> {
if (!task.isSuccessful ()) {
return;
}
if (null != task.getResult ()) {
String firebaseMessagingToken = Objects.requireNonNull ( task.getResult () );
updateToken(firebaseMessagingToken);
}
} );
private void updateToken(String firebaseMessagingToken) {
FirebaseUser firebaseUser = FirebaseAuth.getInstance().getCurrentUser();
DatabaseReference reference = FirebaseDatabase.getInstance().getReference("Tokens");
Token token = new Token(firebaseMessagingToken);
reference.child(firebaseUser.getUid()).setValue(token);
}

Related

BiChannelGoogleApi: [FirebaseAuth: ] getGoogleApiForMethod() returned Gms: com.google.firebase.auth.api.internal.zzaq#a34f859

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);
}
}
}
});
}

.addOnCompleteListener not working for FirebaseInstanceId.getInstance().getInstanceId()

I am new to android development. Before posting this question, I have checked if same issue had been posted and had a solution. I couldn't find and so posting here.
I am trying to get FCM token and using the below piece of code.
FirebaseInstanceId.getInstance().getInstanceId()
.addOnCompleteListener(new OnCompleteListener<InstanceIdResult>() {
#Override
public void onComplete(#NonNull Task<InstanceIdResult> task) {
if (!task.isSuccessful()) {
Log.w(TAG, "getInstanceId failed", task.getException());
return;
}
// Get new Instance ID token
String token = task.getResult().getToken();
// Log and toast
Log.d(TAG, token);
}
});
I am not getting any error. However method onComplete is not getting executed.
Could please someone help me on this. I have been trying this for couple of days.
Please note that, as per few suggestions on SOF, I followed .on SuccessfullListener also. But the same issue with that as well.
I am using the below things.
Manifest:
<service
android:name=".MyFirebaseMessagingService"
android:exported="false">
<intent-filter>
<action android:name="com.google.firebase.MESSAGING_EVENT" />
</intent-filter>
</service>
App level Gradle:
apply plugin: 'com.android.application'
android {
compileSdkVersion 28
defaultConfig {
applicationId "com.example.abc.xyz"
minSdkVersion 21
multiDexEnabled true
targetSdkVersion 28
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:28.0.0'
implementation 'com.android.support:design:28.0.0'
implementation 'com.google.android.gms:play-services-tasks:16.0.1'
implementation 'com.android.support:support-v4:28.0.0'
implementation 'com.google.firebase:firebase-messaging:17.5.0'
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.constraint:constraint-layout:1.1.3'
implementation 'com.google.android.gms:play-services-maps:16.1.0'
implementation 'com.google.firebase:firebase-core:16.0.8'
implementation 'com.google.firebase:firebase-auth:16.2.0'
implementation 'com.google.firebase:firebase-firestore:18.2.0'
implementation 'com.android.support:recyclerview-v7:28.0.0'
implementation 'com.google.firebase:firebase-database:16.1.0'
}
apply plugin: 'com.google.gms.google-services'
Project Gradle:
dependencies {
classpath 'com.android.tools.build:gradle:3.3.2'
classpath 'com.google.gms:google-services:4.2.0'
addOnCompleteListener runs on the background thread so it's not clear when it will be done.
I advice using onNewToken(String token) in your custom FirebaseMessagingService :
public class FireBaseCustomReciver extends FirebaseMessagingService {
private static final String TAG = "aaa";
#Override
public void onMessageReceived(RemoteMessage remoteMessage) {
// ...
}
#Override
public void onNewToken(String token) {
Log.e("aaa", "Refreshed token: " + token);
}
}

Unresolved class for firebase ".MyFirebaseInstanceIDService" and ".java.MyFirebaseMessagingService"

I'm trying to import Firebase and FCM into my android app, but I'm getting
Unresolved class for firebase ".MyFirebaseInstanceIDService"
Unresolved package for firebase ".java.MyFirebaseMessagingService"
as an "error." Of course, it isn't stopping my app from running or building, but I cannot call onTokenRefresh in any class at all. So, I believe this problem is preventing me from using Firebase.
here is my app build;
apply plugin: 'com.android.application'
android {
compileSdkVersion 28
defaultConfig {
applicationId "com.example.northlandcaps.crisis_response"
minSdkVersion 21
targetSdkVersion 28
versionCode 1
versionName "1.0"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
android {
lintOptions {
checkReleaseBuilds false
// Or, if you prefer, you can continue to check for errors in release builds,
// but continue the build even when errors are found:
abortOnError false
}
}
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
implementation 'com.google.firebase:firebase-core:16.0.5'
implementation fileTree(dir: 'libs', include: ['*.jar'])
//noinspection GradleCompatible
implementation 'com.android.support:appcompat-v7:28.0.0'
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 'com.android.support:mediarouter-v7:28.0.0'
implementation 'com.android.volley:volley:1.1.0'
implementation 'com.android.support:recyclerview-v7:28.0.0'
implementation 'com.google.firebase:firebase-messaging:17.3.4'
}
apply plugin: 'com.google.gms.google-services'
Screenshot of problem
This how you two classes should look like:
public class MyFirebaseInstanceIDService extends FirebaseInstanceIdService {
private static final String TAG = "MyFirebaseIIDService";
#Override
public void onTokenRefresh() {
super.onTokenRefresh();
String refreshedToken = FirebaseInstanceId.getInstance().getToken();
Log.d(TAG, "Refreshed token: " + refreshedToken);
sendRegistrationToServer(refreshedToken);
}
private void sendRegistrationToServer(String token) {
// Add custom implementation, as needed.
}
}
And:
public class MyFirebaseMessagingService extends FirebaseMessagingService {
#Override
public void onMessageReceived(RemoteMessage remoteMessage) {
super.onMessageReceived(remoteMessage);
RemoteMessage.Notification notification = remoteMessage.getNotification();
Map<String, String> data = remoteMessage.getData();
sendNotification(notification, data);
}
private void sendNotification(RemoteMessage.Notification notification, Map<String, String> data) {
//Send notification
}
}

Firebase sign in failed on android app

my app is showing error on signin failed on firebase..
in log it says - com,google.firebase.auth not found .
what to do ? i have enabled email/password login in firebase console
here is my code.
public override fun onStart() {
super.onStart()
// Check auth on Activity start
if (mAuth!!.currentUser != null) {
onAuthSuccess(mAuth!!.currentUser)
}
}
private fun signIn() {
Log.d(TAG, "signIn")
if (!validateForm()) {
return
}
showProgressDialog()
val email = mEmailField!!.text.toString()
val password = mPasswordField!!.text.toString()
mAuth!!.signInWithEmailAndPassword(email, password)
.addOnCompleteListener(this) { task ->
Log.d(TAG, "signIn:onComplete:" + task.isSuccessful)
hideProgressDialog()
if (task.isSuccessful) {
onAuthSuccess(task.result.user)
} else {
Toast.makeText(this#SignInActivity, "Sign In Failed",
Toast.LENGTH_SHORT).show()
}
}
}
private fun signUp() {
Log.d(TAG, "signUp")
if (!validateForm()) {
return
}
showProgressDialog()
val email = mEmailField!!.text.toString()
val password = mPasswordField!!.text.toString()
mAuth!!.createUserWithEmailAndPassword(email, password)
.addOnCompleteListener(this) { task ->
Log.d(TAG, "createUser:onComplete:" + task.isSuccessful)
hideProgressDialog()
if (task.isSuccessful) {
onAuthSuccess(task.result.user)
} else {
Toast.makeText(this#SignInActivity, "Sign Up Failed",
Toast.LENGTH_SHORT).show()
}
}
}
here is my gradle module
apply plugin: 'com.android.application'
apply plugin: 'kotlin-android'
apply plugin: 'kotlin-android-extensions'
android {
compileSdkVersion 26
defaultConfig {
applicationId "appname"
minSdkVersion 15
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(dir: 'libs', include: ['*.jar'])
implementation 'com.android.support:appcompat-v7:26.1.0'
implementation 'com.android.support.constraint:constraint-layout:1.0.2'
implementation 'com.android.support:appcompat-v7:26.1.0'
implementation 'com.android.support:recyclerview-v7:26.1.0'
implementation 'com.android.support:cardview-v7:26.1.0'
implementation 'com.android.support:design:26.1.0'
implementation 'com.firebaseui:firebase-ui-database:3.0.0'
implementation 'com.google.android.gms:play-services-auth:11.6.2'
implementation 'com.google.firebase:firebase-auth:11.6.2'
implementation 'com.google.firebase:firebase-database:11.6.2'
implementation 'com.google.firebase:firebase-storage:11.6.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 "org.jetbrains.kotlin:kotlin-stdlib-jre7:$kotlin_version"
}
apply plugin: 'com.google.gms.google-services'
i have changed firebase version to 11.6.2
from 11.4.2

firebase android user database Sign up Error

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

Categories

Resources