강의

멘토링

로드맵

Cộng đồng Hỏi & Đáp của Inflearn

Hình ảnh hồ sơ của hdyeon004509
hdyeon004509

câu hỏi đã được viết

[Dành cho người mới bắt đầu] Học Android Kotlin thông qua việc tạo ra 8 ứng dụng

Firebase Đăng nhập bằng email

09:55 질문입니다!

Viết

·

260

0

-package com.daeyeon.fb_firebase_email_password_auth

import androidx.appcompat.app.AppCompatActivity
import android.os.Bundle
import android.util.Log
import android.widget.Button
import android.widget.EditText
import android.widget.Toast
import com.google.firebase.auth.FirebaseAuth
import com.google.firebase.auth.ktx.auth
import com.google.firebase.ktx.Firebase

class MainActivity : AppCompatActivity() {

private lateinit var auth: FirebaseAuth

override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
setContentView(R.layout.activity_main)

auth = Firebase.auth

val joinBtn = findViewById<Button>(R.id.joinBtn)
joinBtn.setOnClickListener {

val email = findViewById<EditText>(R.id.emailArea)
val password = findViewById<EditText>(R.id.passwordArea)

Log.d("MAIN", email.text.toString())
Log.d("MAIN", password.text.toString())


auth.createUserWithEmailAndPassword(email.text.toString(), password.text.toString())
.addOnCompleteListener(this) { task ->
if (task.isSuccessful) {
// Sign in success, update UI with the signed-in user's information
Toast.makeText(this, "성공", Toast.LENGTH_LONG).show()
} else {
// If sign in fails, display a message to the user.
Toast.makeText(this, "실패", Toast.LENGTH_LONG).show()

}
}

}
}
}
이메일 비번을 치고 회원가입을 누르면 자꾸 실패가 떠요!....
kotlinfirebaseandroid

Quiz

61% người trả lời sai. Hãy thử ngay!

컴퓨팅 시스템에서 서버의 주된 역할은 무엇인가요?

사용자 인터페이스를 디자인하는 역할

클라이언트의 요청에 따라 데이터를 제공하는 역할

앱의 모든 코드를 최종적으로 실행하는 역할

클라이언트 기기의 하드웨어를 직접 제어하는 역할

Câu trả lời 2

1

엌ㅋㅋㅋㅋㅋ 저도 똑같은 문제였어요 감사합니다

0

bokchi님의 프로필 이미지
bokchi
Người chia sẻ kiến thức

아래와 같이 else부분에 Log.d()를 이용해서 task.exception의 내용을 출력해보시겠어요?

이 부분을 실패 부분에 넣어보시면 됩니다.

Log.d(TAG, "createUserWithEmail:failure", task.exception)

 

나오는 로그메세지를 공유해주세요.

 

 

 

auth.createUserWithEmailAndPassword(email, password)
       
.addOnCompleteListener(this) { task ->
           
if (task.isSuccessful) {
               
// Sign in success, update UI with the signed-in user's information
               
Log.d(TAG, "createUserWithEmail:success")
               
val user = auth.currentUser
                updateUI
(user)
           
} else {
               
// If sign in fails, display a message to the user.
               
Log.w(TAG, "createUserWithEmail:failure", task.exception)
               
Toast.makeText(baseContext, "Authentication failed.",
                       
Toast.LENGTH_SHORT).show()
                updateUI
(null)
           
}
       
}
D Y님의 프로필 이미지
D Y
Người đặt câu hỏi

세상에 선생님.... 로그에 The given password is invalid. [ Password should be at least 6 characters ] 이렇게 떠서 6글자 로 해봤더니 성공이라 뜨네요 ㅜㅜㅜㅜ 감사합니다 ㅜㅜㅜ

Hình ảnh hồ sơ của hdyeon004509
hdyeon004509

câu hỏi đã được viết

Đặt câu hỏi