Skip to main content
se añadieron 160 caracteres en el cuerpo
Origen Enlace
Diego Avila
  • 5.5k
  • 6
  • 21
  • 48

class LoginActivity : AppCompatActivity() {

class LoginActivity : AppCompatActivity() {

    private val mAuth: FirebaseAuth by lazy { FirebaseAuth.getInstance() }

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

        buttonLogIn_LoginAc.setOnClickListener {
            val email = editTextEmail_LoginAc.text.toString()
            val password = editTextPassword_LoginAc.text.toString()
            if (isValidEmailAndPassword(email, password)){
                logInByEmail(email, password)
            }
        }

        textViewForgotPassword_LoginAc.setOnClickListener {
            goToActivity<ForgotPasswordActivity>()
            overridePendingTransition(android.R.anim.slide_in_left, android.R.anim.slide_out_right)
        }

        buttonCreateAccount_LoginAc.setOnClickListener {
            goToActivity<SignUpActivity>()
            overridePendingTransition(android.R.anim.slide_in_left, android.R.anim.slide_out_right)
        }
    }

    private fun logInByEmail(email: String, password: String){
        mAuth.signInWithEmailAndPassword(email, password).addOnCompleteListener(this) {task ->
            if (task.isSuccessful) {
                toast("User is now logg in")
            }else {

                toast("an unexpected error occurred, please try again.")
            }
        }
    }
    private fun isValidEmailAndPassword(email: String, password: String): Boolean{
        return !email.isNullOrEmpty() && !password.isNullOrEmpty()
    }}

class LoginActivity : AppCompatActivity() {

private val mAuth: FirebaseAuth by lazy { FirebaseAuth.getInstance() }

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

    buttonLogIn_LoginAc.setOnClickListener {
        val email = editTextEmail_LoginAc.text.toString()
        val password = editTextPassword_LoginAc.text.toString()
        if (isValidEmailAndPassword(email, password)){
            logInByEmail(email, password)
        }
    }

    textViewForgotPassword_LoginAc.setOnClickListener {
        goToActivity<ForgotPasswordActivity>()
        overridePendingTransition(android.R.anim.slide_in_left, android.R.anim.slide_out_right)
    }

    buttonCreateAccount_LoginAc.setOnClickListener {
        goToActivity<SignUpActivity>()
        overridePendingTransition(android.R.anim.slide_in_left, android.R.anim.slide_out_right)
    }
}

private fun logInByEmail(email: String, password: String){
    mAuth.signInWithEmailAndPassword(email, password).addOnCompleteListener(this) {task ->
        if (task.isSuccessful) {
            toast("User is now logg in")
        }else {

            toast("an unexpected error occurred, please try again.")
        }
    }
}
private fun isValidEmailAndPassword(email: String, password: String): Boolean{
    return !email.isNullOrEmpty() && !password.isNullOrEmpty()
}}
class LoginActivity : AppCompatActivity() {

    private val mAuth: FirebaseAuth by lazy { FirebaseAuth.getInstance() }

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

        buttonLogIn_LoginAc.setOnClickListener {
            val email = editTextEmail_LoginAc.text.toString()
            val password = editTextPassword_LoginAc.text.toString()
            if (isValidEmailAndPassword(email, password)){
                logInByEmail(email, password)
            }
        }

        textViewForgotPassword_LoginAc.setOnClickListener {
            goToActivity<ForgotPasswordActivity>()
            overridePendingTransition(android.R.anim.slide_in_left, android.R.anim.slide_out_right)
        }

        buttonCreateAccount_LoginAc.setOnClickListener {
            goToActivity<SignUpActivity>()
            overridePendingTransition(android.R.anim.slide_in_left, android.R.anim.slide_out_right)
        }
    }

    private fun logInByEmail(email: String, password: String){
        mAuth.signInWithEmailAndPassword(email, password).addOnCompleteListener(this) {task ->
            if (task.isSuccessful) {
                toast("User is now logg in")
            }else {

                toast("an unexpected error occurred, please try again.")
            }
        }
    }
    private fun isValidEmailAndPassword(email: String, password: String): Boolean{
        return !email.isNullOrEmpty() && !password.isNullOrEmpty()
    }}
Origen Enlace

java.lang.NoClassDefFoundError: Failed resolution of: Landroid/view/View$OnUnhandledKeyEventListener;

estoy desarrollando un proyecto en kotlin, intento hacer un debug pero me aparece lo siguiente y no me deja usarlo introducir la descripción de la imagen aquí

este es el codigo del LoginActivity.kt

la linea 18 es setContentView(R.layout.activity_login)

class LoginActivity : AppCompatActivity() {

private val mAuth: FirebaseAuth by lazy { FirebaseAuth.getInstance() }

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

    buttonLogIn_LoginAc.setOnClickListener {
        val email = editTextEmail_LoginAc.text.toString()
        val password = editTextPassword_LoginAc.text.toString()
        if (isValidEmailAndPassword(email, password)){
            logInByEmail(email, password)
        }
    }

    textViewForgotPassword_LoginAc.setOnClickListener {
        goToActivity<ForgotPasswordActivity>()
        overridePendingTransition(android.R.anim.slide_in_left, android.R.anim.slide_out_right)
    }

    buttonCreateAccount_LoginAc.setOnClickListener {
        goToActivity<SignUpActivity>()
        overridePendingTransition(android.R.anim.slide_in_left, android.R.anim.slide_out_right)
    }
}

private fun logInByEmail(email: String, password: String){
    mAuth.signInWithEmailAndPassword(email, password).addOnCompleteListener(this) {task ->
        if (task.isSuccessful) {
            toast("User is now logg in")
        }else {

            toast("an unexpected error occurred, please try again.")
        }
    }
}
private fun isValidEmailAndPassword(email: String, password: String): Boolean{
    return !email.isNullOrEmpty() && !password.isNullOrEmpty()
}}

este el gradle app

introducir la descripción de la imagen aquí

introducir la descripción de la imagen aquí

y este es el gradle proyect introducir la descripción de la imagen aquí

es curioso porque cuando ejecuto el app en el activity de loginActivity no me muestra los Toast a comparación de los otros activities que si los muestran.

posdata: YA intente rebuild proyect, clean proyect , invalidate Cache and Restart y nada...

por la atención que le presten a mi pequeño error (si es que es un error) estaré altamente agradecido-