내 애플리케이션에 인증 페이지를 구현하려고합니다. 내 중포 기지 데이터베이스에 이메일 인증을 활성화하고 코딩 내가 제출 버튼을 클릭하고 디버깅 할 때Firebase 인증 createUserWithEmailAndPassword가 Android에서 작동하지 않습니다.
public class AdminLoginActivity extends AppCompatActivity {
private Button loginButton;
private EditText inputEmail;
private EditText inputPassword;
private TextView loginText;
//private ProgressDialog progressDialog;
//Firebase Authentication Object
private FirebaseAuth firebaseAuth;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_admin_login);
//progressDialog = new ProgressDialog(AdminLoginActivity.this);
firebaseAuth = FirebaseAuth.getInstance();
loginButton = (Button) findViewById(R.id.login_button);
inputEmail = (EditText) findViewById(R.id.enter_email);
inputPassword = (EditText) findViewById(R.id.enter_password);
loginText = (TextView) findViewById(R.id.newaccount_text);
loginButton.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
accountLogin();
}
});
loginText.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
}
});
}
private void accountLogin() {
String email = inputEmail.getText().toString().trim();
String password = inputPassword.getText().toString().trim();
// valid input
//progressDialog.setTitle("Loading...");
//progressDialog.setMessage("Logging in...");
//progressDialog.setProgressStyle(ProgressDialog.STYLE_SPINNER);
//progressDialog.show();
// Creates a user with a given email and password in the database
(firebaseAuth.createUserWithEmailAndPassword(email, password))
.addOnCompleteListener(AdminLoginActivity.this, new OnCompleteListener<AuthResult>() {
@Override
public void onComplete(@NonNull Task<AuthResult> task) {
if(task.isSuccessful()) {
//successfully signed in
//start new activity
Toast.makeText(AdminLoginActivity.this, "Success", Toast.LENGTH_SHORT).show();
//progressDialog.hide();
} else {
Toast.makeText(AdminLoginActivity.this, "Fail", Toast.LENGTH_SHORT).show();
}
}
});
}
}
, 그것은이 createUserWithEmailAndPassword
기능에 도달하지 않은 다음과 같이. 그것은 그저 멈춘다. Firebase 데이터베이스를 검사 할 때 아무 것도 추가되지 않습니다.
어떤 오류가 있습니까?
편집 :
11-20 04:58:56.884 12640-12678/ykim164cs242.tournamentor E/FA: Discarding data. Failed to send app launch
11-20 04:58:56.887 12640-12678/ykim164cs242.tournamentor E/FA: Failed to get app instance id
11-20 04:58:56.889 12640-12678/ykim164cs242.tournamentor E/FA: Failed to send current screen to service
11-20 04:58:56.891 12640-12678/ykim164cs242.tournamentor E/FA: Discarding data. Failed to send event to service
EDIT2
build.gradle
apply plugin: 'com.android.application'
android {
compileSdkVersion 26
buildToolsVersion "26.0.2"
defaultConfig {
applicationId "-----------"
minSdkVersion 15
targetSdkVersion 26
versionCode 1
versionName "1.0"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
vectorDrawables.useSupportLibrary = true
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', {
exclude group: 'com.android.support', module: 'support-annotations'
})
compile 'com.android.support:design:26.+'
compile 'com.android.support:appcompat-v7:26.+'
compile 'com.android.support.constraint:constraint-layout:1.0.2'
compile 'com.android.support:support-vector-drawable:26.+'
compile 'com.google.firebase:firebase-core:11.0.4'
compile 'com.google.firebase:firebase-database:11.0.4'
compile 'com.google.firebase:firebase-auth:11.0.4'
compile 'com.android.support:support-v4:26.+'
testCompile 'junit:junit:4.12'
}
apply plugin: 'com.google.gms.google-services'
`최고 수준의 Gradle을 '
// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
repositories {
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:2.3.3'
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 {
jcenter()
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}
activity_admin_login.xml
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
tools:context="ykim164cs242.tournamentor.Activity.Admin.AdminLoginActivity">
<EditText
android:hint="Enter your email"
android:id="@+id/enter_email"
android:layout_margin="15dp"
android:layout_width="match_parent"
android:layout_height="wrap_content" />
<EditText
android:id="@+id/enter_password"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_margin="15dp"
android:hint="Enter your password" />
<Button
android:id="@+id/login_button"
android:text="Manage Tournament"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_margin="15dp" />
<TextView
android:id="@+id/newaccount_text"
android:text="Want to set up a new tournament? Click here"
android:textAlignment="center"
android:layout_width="match_parent"
android:layout_height="wrap_content" />
</LinearLayout>
UI
오류 로그를 보내주십시오. 오류 로그가 없으면 오류를 해결할 수 없습니다. –
@AmrishKakadiya 내 앱이 실제로 충돌하는 것이 아니라 내 편집본에 표시된대로 메시지를받는 것 – Dawn17
비밀번호 길이는 firebase auth에서 6보다 커야합니다. 그것을 시도하십시오. –