Java 安卓工作室+;FireBase帐户设置引发错误
我似乎不明白为什么我的程序没有通过帐户注册活动 我的问题发生在这里的某个地方Java 安卓工作室+;FireBase帐户设置引发错误,java,android,firebase,android-studio,firebase-authentication,Java,Android,Firebase,Android Studio,Firebase Authentication,我似乎不明白为什么我的程序没有通过帐户注册活动 我的问题发生在这里的某个地方 else if (!(use_email.isEmpty() && use_pass.isEmpty())) { mFirebaseAuth.createUserWithEmailAndPassword( use_email, use_pass).addOnCompleteListener(SignUpActivity.this, new OnCompleteLi
else if (!(use_email.isEmpty() && use_pass.isEmpty())) {
mFirebaseAuth.createUserWithEmailAndPassword( use_email, use_pass).addOnCompleteListener(SignUpActivity.this, new OnCompleteListener<AuthResult>() {
@Override
public void onComplete(@NonNull Task<AuthResult> task) {
if (task.isSuccessful()) {
startActivity(new Intent(SignUpActivity.this, LoginFormActivity.class));
}
else {
//My problem happens Here
Toast.makeText(SignUpActivity.this, "Account Setup Error", Toast.LENGTH_SHORT).show();
build.gradle
// 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:4.1.2"
classpath 'com.google.gms:google-services:4.3.5'
// 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
}
也许是版本的问题。使用此版本
实施平台('com.google.firebase:firebase bom:26.4.0')
确保您必须在firebase控制台中启用电子邮件和密码作为登录方法,并且如果您使用的是实施平台('com.google.firebase:firebase bom:26.5.0')
那么您就不需要为以下内容定义版本:
实现'com.google.firebase:firebase auth:19.3.1'
bom表自动采用最新版本
替换将是:
implementation'com.google.firebase:firebase auth感谢您的回复!我做了更改,但不幸的是,结果是一样的。感谢您的回复,我在firebase控制台上启用了电子邮件/密码。
plugins {
id 'com.android.application'
id 'com.google.gms.google-services'
}
android {
compileSdkVersion 30
buildToolsVersion "30.0.3"
defaultConfig {
applicationId "com.example.vehicledoctor"
minSdkVersion 16
targetSdkVersion 30
versionCode 1
versionName "1.0"
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
}
}
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
}
dependencies {
implementation 'androidx.appcompat:appcompat:1.2.0'
implementation 'com.google.android.material:material:1.2.1'
implementation 'androidx.constraintlayout:constraintlayout:2.0.4'
implementation 'com.google.firebase:firebase-auth:19.3.1'
testImplementation 'junit:junit:4.+'
androidTestImplementation 'androidx.test.ext:junit:1.1.2'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.3.0'
implementation platform('com.google.firebase:firebase-bom:26.5.0')
implementation 'com.google.firebase:firebase-analytics'
implementation 'com.google.firebase:firebase-analytics'
}
// 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:4.1.2"
classpath 'com.google.gms:google-services:4.3.5'
// 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
}