인프런 커뮤니티 질문&답변

박찬희님의 프로필 이미지
박찬희

작성한 질문수

[초중급편] 안드로이드 데이팅 앱 만들기(Android Kotlin)

섹션 3 - 1 진행 중 회원가입이 되지 않는 문제

작성

·

1K

0

섹션 3 - 1 진행 중 JoinActivity에 myRef = database.getReference("message") 까지 하고 실행을 해 보니 데이터베이스에 정보가 올라가지 않고 아예 회원가입 자체가 되질 않고 있습니다. 정보를 입력하고 가입을 누르면 가입이 되지 않고 introActivity로 돌아가는 상황입니다.

어디서 문제인지 확인해보려 한 단계씩 하면서 실행을 해 보니

table = findViewById<TextInputEditText>(R.id.tableArea).text.toString()

introduce = findViewById<TextInputEditText>(R.id.introduceArea).text.toString()

이 부분을 입력 한 후에 실행을 했을 때 위와 같은 문제가 발생하고 있는데 어디가 문제인 걸까요..?

참고로 저는 JoinActivity를 아이디,비밀번호,번호(tableArea),소개(introduceArea) 이렇게 4개만 입력하게 구성했습니다.

package com.cockandroid.dating.auth

import android.content.ContentValues.TAG
import androidx.appcompat.app.AppCompatActivity
import android.os.Bundle
import android.util.Log
import android.widget.Button
import com.cockandroid.dating.R
import com.google.android.material.textfield.TextInputEditText
import com.google.firebase.auth.FirebaseAuth
import com.google.firebase.auth.ktx.auth
import com.google.firebase.database.ktx.database
import com.google.firebase.ktx.Firebase

class JoinActivity : AppCompatActivity() {

    private lateinit var auth: FirebaseAuth

        private var uid = ""
        private var table = ""
        private var introduce = ""

//    private val TAG = "JoinActivity"

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

        auth = Firebase.auth

        val newbtn =findViewById<Button>(R.id.newbtn)
        newbtn.setOnClickListener {
            val ID = findViewById<TextInputEditText>(R.id.IDArea)
            val password = findViewById<TextInputEditText>(R.id.passwordArea)

            table = findViewById<TextInputEditText>(R.id.tableArea).text.toString()
            introduce = findViewById<TextInputEditText>(R.id.introduceArea).text.toString()



            auth.createUserWithEmailAndPassword(ID.text.toString(), password.text.toString())
                .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
                        uid = user?.uid.toString()

                        val database = Firebase.database
                        val myRef = database.getReference("message")

                        myRef.setValue("Hello, World!")
//                        updateUI(user)
//                        val intent = Intent(this, MainActivity::class.java)
//                        startActivity(intent)

                    } 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)
                    }
                }
        }
    }
}

답변 1

0

개복치개발자님의 프로필 이미지
개복치개발자
지식공유자

안녕하세요

혹시 로그가 나올까요?

그리고 강의 영상 기준으로 어디까지 되고 어디부터 안되었는지 플레이타임을 알려주시겠어요?

박찬희님의 프로필 이미지
박찬희
질문자

섹션3 -1의 8분 15초까지 따라하고 실행을 해보니 해당 문제가 발생하였고 처음부터 실행하면서 어디서 문제가 생기는지 봤더니 6분 20초 부분에서 해당 문제가 발생하였습니다.

로그캣은 다음과 같이 나왔습니다.

2022-11-05 11:49:42.592 14119-14119/? I/kandroid.datin: Late-enabling -Xcheck:jni

2022-11-05 11:49:42.609 14119-14119/? W/kandroid.datin: Unexpected CPU variant for X86 using defaults: x86_64

2022-11-05 11:49:42.668 14119-14119/? V/studio.deploy: No existing instrumentation found. Loading instrumentation from instruments-48c1f2f9.jar

2022-11-05 11:49:42.670 14119-14119/? W/kandroid.datin: DexFile /data/data/com.cockandroid.dating/code_cache/.studio/instruments-48c1f2f9.jar is in boot class path but is not in a known location

2022-11-05 11:49:42.692 14119-14119/com.cockandroid.dating W/kandroid.datin: Redefining intrinsic method java.lang.Thread java.lang.Thread.currentThread(). This may cause the unexpected use of the original definition of java.lang.Thread java.lang.Thread.currentThread()in methods that have already been compiled.

2022-11-05 11:49:42.692 14119-14119/com.cockandroid.dating W/kandroid.datin: Redefining intrinsic method boolean java.lang.Thread.interrupted(). This may cause the unexpected use of the original definition of boolean java.lang.Thread.interrupted()in methods that have already been compiled.

2022-11-05 11:49:42.698 14119-14119/com.cockandroid.dating D/CompatibilityChangeReporter: Compat change id reported: 171979766; UID 10150; state: ENABLED

2022-11-05 11:49:42.592 14119-14119/? I/kandroid.datin: Late-enabling -Xcheck:jni

2022-11-05 11:49:42.609 14119-14119/? W/kandroid.datin: Unexpected CPU variant for X86 using defaults: x86_64

2022-11-05 11:49:42.656 14119-14119/? W/re-initialized>: type=1400 audit(0.0:80): avc: granted { execute } for path="/data/data/com.cockandroid.dating/code_cache/startup_agents/8a4580ab-agent.so" dev="dm-5" ino=140896 scontext=u:r:untrusted_app:s0:c150,c256,c512,c768 tcontext=u:object_r:app_data_file:s0:c150,c256,c512,c768 tclass=file app=com.cockandroid.dating

2022-11-05 11:49:42.668 14119-14119/? V/studio.deploy: Startup agent attached to VM

2022-11-05 11:49:42.668 14119-14119/? V/studio.deploy: No existing instrumentation found. Loading instrumentation from instruments-48c1f2f9.jar

2022-11-05 11:49:42.670 14119-14119/? W/kandroid.datin: DexFile /data/data/com.cockandroid.dating/code_cache/.studio/instruments-48c1f2f9.jar is in boot class path but is not in a known location

2022-11-05 11:49:42.692 14119-14119/com.cockandroid.dating W/kandroid.datin: Redefining intrinsic method java.lang.Thread java.lang.Thread.currentThread(). This may cause the unexpected use of the original definition of java.lang.Thread java.lang.Thread.currentThread()in methods that have already been compiled.

2022-11-05 11:49:42.692 14119-14119/com.cockandroid.dating W/kandroid.datin: Redefining intrinsic method boolean java.lang.Thread.interrupted(). This may cause the unexpected use of the original definition of boolean java.lang.Thread.interrupted()in methods that have already been compiled.

2022-11-05 11:49:42.698 14119-14119/com.cockandroid.dating D/CompatibilityChangeReporter: Compat change id reported: 171979766; UID 10150; state: ENABLED

2022-11-05 11:49:42.592 14119-14119/? I/kandroid.datin: Late-enabling -Xcheck:jni

2022-11-05 11:49:42.609 14119-14119/? W/kandroid.datin: Unexpected CPU variant for X86 using defaults: x86_64

2022-11-05 11:49:42.656 14119-14119/? W/re-initialized>: type=1400 audit(0.0:80): avc: granted { execute } for path="/data/data/com.cockandroid.dating/code_cache/startup_agents/8a4580ab-agent.so" dev="dm-5" ino=140896 scontext=u:r:untrusted_app:s0:c150,c256,c512,c768 tcontext=u:object_r:app_data_file:s0:c150,c256,c512,c768 tclass=file app=com.cockandroid.dating

2022-11-05 11:49:42.668 14119-14119/? V/studio.deploy: Startup agent attached to VM

2022-11-05 11:49:42.668 14119-14119/? V/studio.deploy: No existing instrumentation found. Loading instrumentation from instruments-48c1f2f9.jar

2022-11-05 11:49:42.670 14119-14119/? W/kandroid.datin: DexFile /data/data/com.cockandroid.dating/code_cache/.studio/instruments-48c1f2f9.jar is in boot class path but is not in a known location

2022-11-05 11:49:42.672 14119-14119/? V/studio.deploy: Applying transforms with cached classes

2022-11-05 11:49:42.692 14119-14119/com.cockandroid.dating W/kandroid.datin: Redefining intrinsic method java.lang.Thread java.lang.Thread.currentThread(). This may cause the unexpected use of the original definition of java.lang.Thread java.lang.Thread.currentThread()in methods that have already been compiled.

2022-11-05 11:49:42.692 14119-14119/com.cockandroid.dating W/kandroid.datin: Redefining intrinsic method boolean java.lang.Thread.interrupted(). This may cause the unexpected use of the original definition of boolean java.lang.Thread.interrupted()in methods that have already been compiled.

2022-11-05 11:49:42.698 14119-14119/com.cockandroid.dating D/CompatibilityChangeReporter: Compat change id reported: 171979766; UID 10150; state: ENABLED

2022-11-05 11:49:42.886 14119-14119/com.cockandroid.dating V/GraphicsEnvironment: ANGLE Developer option for 'com.cockandroid.dating' set to: 'default'

2022-11-05 11:49:42.887 14119-14119/com.cockandroid.dating V/GraphicsEnvironment: Neither updatable production driver nor prerelease driver is supported.

2022-11-05 11:49:42.890 14119-14119/com.cockandroid.dating D/NetworkSecurityConfig: No Network Security Config specified, using platform default

2022-11-05 11:49:42.890 14119-14119/com.cockandroid.dating D/NetworkSecurityConfig: No Network Security Config specified, using platform default

2022-11-05 11:49:42.930 14119-14119/com.cockandroid.dating I/FirebaseApp: Device unlocked: initializing all Firebase APIs for app [DEFAULT]

2022-11-05 11:49:42.983 14119-14119/com.cockandroid.dating I/FirebaseInitProvider: FirebaseApp initialization successful

2022-11-05 11:49:43.008 14119-14151/com.cockandroid.dating I/DynamiteModule: Considering local module com.google.android.gms.measurement.dynamite:86 and remote module com.google.android.gms.measurement.dynamite:54

2022-11-05 11:49:43.010 14119-14151/com.cockandroid.dating I/DynamiteModule: Selected local version of com.google.android.gms.measurement.dynamite

2022-11-05 11:49:43.019 14119-14157/com.cockandroid.dating D/libEGL: loaded /vendor/lib64/egl/libEGL_emulation.so

2022-11-05 11:49:43.022 14119-14157/com.cockandroid.dating D/libEGL: loaded /vendor/lib64/egl/libGLESv1_CM_emulation.so

2022-11-05 11:49:43.026 14119-14157/com.cockandroid.dating D/libEGL: loaded /vendor/lib64/egl/libGLESv2_emulation.so

2022-11-05 11:49:43.087 14119-14151/com.cockandroid.dating V/FA: onActivityCreated

2022-11-05 11:49:43.104 14119-14158/com.cockandroid.dating V/FA: App measurement collection enabled

2022-11-05 11:49:43.104 14119-14158/com.cockandroid.dating V/FA: App measurement enabled for app package, google app id: com.cockandroid.dating, 1:424986070891:android:3d8c69c82d725a5648062e

2022-11-05 11:49:43.106 14119-14158/com.cockandroid.dating I/FA: App measurement initialized, version: 74029

2022-11-05 11:49:43.106 14119-14158/com.cockandroid.dating I/FA: To enable debug logging run: adb shell setprop log.tag.FA VERBOSE

2022-11-05 11:49:43.106 14119-14158/com.cockandroid.dating I/FA: To enable faster debug mode event logging run:

adb shell setprop debug.firebase.analytics.app com.cockandroid.dating

2022-11-05 11:49:43.107 14119-14158/com.cockandroid.dating D/FA: Debug-level message logging enabled

2022-11-05 11:49:43.117 14119-14119/com.cockandroid.dating W/kandroid.datin: Accessing hidden method Landroid/view/View;->computeFitSystemWindows(Landroid/graphics/Rect;Landroid/graphics/Rect;)Z (unsupported, reflection, allowed)

2022-11-05 11:49:43.118 14119-14119/com.cockandroid.dating W/kandroid.datin: Accessing hidden method Landroid/view/ViewGroup;->makeOptionalFitsSystemWindows()V (unsupported, reflection, allowed)

2022-11-05 11:49:43.126 14119-14158/com.cockandroid.dating D/FA: Resetting session stitching token to not null

2022-11-05 11:49:43.154 14119-14158/com.cockandroid.dating V/FA: Connecting to remote service

2022-11-05 11:49:43.170 14119-14158/com.cockandroid.dating V/FA: Connection attempt already in progress

2022-11-05 11:49:43.173 14119-14158/com.cockandroid.dating V/FA: Connection attempt already in progress

2022-11-05 11:49:43.216 14119-14158/com.cockandroid.dating V/FA: Activity resumed, time: 28023196

2022-11-05 11:49:43.218 14119-14158/com.cockandroid.dating I/FA: Tag Manager is not found and thus will not be used

2022-11-05 11:49:43.242 14119-14158/com.cockandroid.dating V/FA: Connection attempt already in progress

2022-11-05 11:49:43.242 14119-14158/com.cockandroid.dating V/FA: Connection attempt already in progress

2022-11-05 11:49:43.252 14119-14155/com.cockandroid.dating D/HostConnection: createUnique: call

2022-11-05 11:49:43.252 14119-14155/com.cockandroid.dating D/HostConnection: HostConnection::get() New Host Connection established 0x7dcbf8a0f890, tid 14155

2022-11-05 11:49:43.257 14119-14155/com.cockandroid.dating D/HostConnection: HostComposition ext ANDROID_EMU_CHECKSUM_HELPER_v1 ANDROID_EMU_native_sync_v2 ANDROID_EMU_native_sync_v3 ANDROID_EMU_native_sync_v4 ANDROID_EMU_dma_v1 ANDROID_EMU_direct_mem ANDROID_EMU_host_composition_v1 ANDROID_EMU_host_composition_v2 ANDROID_EMU_vulkan ANDROID_EMU_deferred_vulkan_commands ANDROID_EMU_vulkan_null_optional_strings ANDROID_EMU_vulkan_create_resources_with_requirements ANDROID_EMU_YUV_Cache ANDROID_EMU_vulkan_ignored_handles ANDROID_EMU_has_shared_slots_host_memory_allocator ANDROID_EMU_vulkan_free_memory_sync ANDROID_EMU_vulkan_shader_float16_int8 ANDROID_EMU_vulkan_async_queue_submit ANDROID_EMU_vulkan_queue_submit_with_commands ANDROID_EMU_sync_buffer_data ANDROID_EMU_read_color_buffer_dma GL_OES_vertex_array_object GL_KHR_texture_compression_astc_ldr ANDROID_EMU_host_side_tracing ANDROID_EMU_gles_max_version_2

2022-11-05 11:49:43.258 14119-14155/com.cockandroid.dating W/OpenGLRenderer: Failed to choose config with EGL_SWAP_BEHAVIOR_PRESERVED, retrying without...

2022-11-05 11:49:43.259 14119-14155/com.cockandroid.dating W/OpenGLRenderer: Failed to initialize 101010-2 format, error = EGL_SUCCESS

2022-11-05 11:49:43.264 14119-14155/com.cockandroid.dating D/EGL_emulation: eglCreateContext: 0x7dcbf8a0ec90: maj 2 min 0 rcv 2

2022-11-05 11:49:43.291 14119-14155/com.cockandroid.dating D/EGL_emulation: eglMakeCurrent: 0x7dcbf8a0ec90: ver 2 0 (tinfo 0x7dce19ea7080) (first time)

2022-11-05 11:49:43.297 14119-14155/com.cockandroid.dating I/Gralloc4: mapper 4.x is not supported

2022-11-05 11:49:43.299 14119-14155/com.cockandroid.dating D/HostConnection: createUnique: call

2022-11-05 11:49:43.299 14119-14155/com.cockandroid.dating D/HostConnection: HostConnection::get() New Host Connection established 0x7dcbf8a0f710, tid 14155

2022-11-05 11:49:43.300 14119-14155/com.cockandroid.dating D/goldfish-address-space: allocate: Ask for block of size 0x100

2022-11-05 11:49:43.300 14119-14155/com.cockandroid.dating D/goldfish-address-space: allocate: ioctl allocate returned offset 0x3efffe000 size 0x2000

2022-11-05 11:49:43.301 14119-14155/com.cockandroid.dating W/Gralloc4: allocator 4.x is not supported

2022-11-05 11:49:43.308 14119-14155/com.cockandroid.dating D/HostConnection: HostComposition ext ANDROID_EMU_CHECKSUM_HELPER_v1 ANDROID_EMU_native_sync_v2 ANDROID_EMU_native_sync_v3 ANDROID_EMU_native_sync_v4 ANDROID_EMU_dma_v1 ANDROID_EMU_direct_mem ANDROID_EMU_host_composition_v1 ANDROID_EMU_host_composition_v2 ANDROID_EMU_vulkan ANDROID_EMU_deferred_vulkan_commands ANDROID_EMU_vulkan_null_optional_strings ANDROID_EMU_vulkan_create_resources_with_requirements ANDROID_EMU_YUV_Cache ANDROID_EMU_vulkan_ignored_handles ANDROID_EMU_has_shared_slots_host_memory_allocator ANDROID_EMU_vulkan_free_memory_sync ANDROID_EMU_vulkan_shader_float16_int8 ANDROID_EMU_vulkan_async_queue_submit ANDROID_EMU_vulkan_queue_submit_with_commands ANDROID_EMU_sync_buffer_data ANDROID_EMU_read_color_buffer_dma GL_OES_vertex_array_object GL_KHR_texture_compression_astc_ldr ANDROID_EMU_host_side_tracing ANDROID_EMU_gles_max_version_2

2022-11-05 11:49:43.356 14119-14158/com.cockandroid.dating D/FA: Connected to remote service

2022-11-05 11:49:43.357 14119-14158/com.cockandroid.dating V/FA: Processing queued up service tasks: 5

2022-11-05 11:49:44.618 14119-14133/com.cockandroid.dating W/System: A resource failed to call close.

2022-11-05 11:49:48.428 14119-14158/com.cockandroid.dating V/FA: Inactivity, disconnecting from the service

개복치개발자님의 프로필 이미지
개복치개발자
지식공유자

코드를 깃허브에 올려주시고 링크 공유해주시면 한번 살펴보겠습니다.

박찬희님의 프로필 이미지
박찬희
질문자

개복치개발자님의 프로필 이미지
개복치개발자
지식공유자

여기에서 에러가 나고 있네요

 

<com.google.android.material.textfield.TextInputLayout
    android:background="@color/white"
    android:id="@+id/tableArea"
    android:layout_margin="10dp"
    android:layout_width="match_parent"
    android:layout_height="wrap_content">

    <com.google.android.material.textfield.TextInputEditText
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:hint="번호" />
</com.google.android.material.textfield.TextInputLayout>

 

table = findViewById<TextInputEditText>(R.id.tableArea).text.toString()

 

실제로 TextInputEditText에 입력을 하고 있으니

TextInputEditText에 id값을 붙이시고, 다시 시도해보시겠어요?

이해가 어려우시다면 강의 자료의 코드와 비교해서 한번 시도해보시면 좋으실 듯 합니다.

 

 

박찬희님의 프로필 이미지
박찬희
질문자

image

해결되었습니다! 감사합니다!

박찬희님의 프로필 이미지
박찬희

작성한 질문수

질문하기