我在调用具有此ligne:FirebaseAuth.getInstances();的函数时遇到了这个问题。
这是我调用此函数时遇到的问题:
W/System.err: java.lang.NoSuchMethodError: No virtual method zzbqp()Ljava/lang/String; in class Lcom/google/firebase/FirebaseApp; or its super classes (declaration of 'com.google.firebase.FirebaseApp' appears in /data/app/com.probadr98.trollapp-1/base.apk)
W/System.err: at com.google.firebase.auth.FirebaseAuth.zzb(Unknown Source)
at com.google.firebase.auth.FirebaseAuth.getInstance(Unknown Source)
at com.probadr98.trollapp.DB.addToDB(LoginFragment.java:223)
at org.chromium.base.SystemMessageHandler.nativeDoRunLoopOnce(Native Method)
at org.chromium.base.SystemMessageHandler.handleMessage(SystemMessageHandler.java:9)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:154)
at android.os.HandlerThread.run(HandlerThread.java:61)
解决此问题的功能
final ProgressDialog progressDialog=new ProgressDialog(context);
firebaseAuth = FirebaseAuth.getInstance();
progressDialog.setMessage("Registering......");
progressDialog.show();
firebaseAuth.createUserWithEmailAndPassword(jemail, jpassword).addOnCompleteListener(new OnCompleteListener <AuthResult>() {
@Override
public void onComplete(@NonNull Task <AuthResult> task) {
if (task.isSuccessful()) {
progressDialog.cancel();
Toast.makeText(context, "Registered Successfully", Toast.LENGTH_LONG).show();
} else {
progressDialog.cancel();
Toast.makeText(context, "Failed to Register!!", Toast.LENGTH_LONG).show();
}
}
});
}
build.gradle:
apply plugin: 'com.android.application'
android {
compileSdkVersion 28
defaultConfig {
applicationId "com.probadr98.trollapp"
minSdkVersion 17
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.google.firebase:firebase-core:16.0.7'
implementation 'com.android.support:design:28.0.0'
implementation 'com.android.support.constraint:constraint-layout:1.1.3'
implementation 'com.google.firebase:firebase-storage:11.8.0'
implementation 'com.google.firebase:firebase-database:11.8.0'
implementation 'com.google.firebase:firebase-auth:11.8.0'
testImplementation 'junit:junit:4.12'
androidTestImplementation 'com.android.support.test:runner:1.0.2'
implementation 'com.google.android.gms:play-services-ads:17.1.3'
androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.2'
}
apply plugin: 'com.google.gms.google-services'
有人可以帮我删除此问题,并且对英语中的任何错误表示抱歉,因为不是我的母语!
答案 0 :(得分:0)
您正在混淆Firebase库的不兼容版本:
implementation 'com.google.firebase:firebase-core:16.0.7'
implementation 'com.google.firebase:firebase-storage:11.8.0'
implementation 'com.google.firebase:firebase-database:11.8.0'
implementation 'com.google.firebase:firebase-auth:11.8.0'
与核心相比,您对存储,数据库和身份验证的依赖性已过时。您应该将它们全部设置为documentation中列出的最新版本:
implementation 'com.google.firebase:firebase-core:16.0.7'
implementation 'com.google.firebase:firebase-storage:16.0.5'
implementation 'com.google.firebase:firebase-database:16.0.6'
implementation 'com.google.firebase:firebase-auth:16.1.0'