๋ณธ๋ฌธ ๋ฐ”๋กœ๊ฐ€๊ธฐ
๐Ÿค2024 ์•ˆ๋“œ๋กœ์ด๋“œ/๐Ÿฟ ์˜ํ™” ํ”„๋กœ์ ํŠธ ๊ฐœ๋ฐœ ์ผ์ง€

๋กœ๊ทธ์ธ ์„ฑ๊ณต ์‹œ ์ฒ˜๋ฆฌ ์—๋Ÿฌ ํ•ด๊ฒฐํ•˜๊ธฐ

by hyeonha 2024. 5. 13.

๋ชฉ์ฐจ

    ๋“ค์–ด๊ฐ€๊ธฐ์ „์—

    ํ˜„์žฌ ๋กœ๊ทธ์ธ์ด ์„ฑ๊ณตํ•œ ๊ฒฝ์šฐ ๋ฉ”์ธ ํ™”๋ฉด์œผ๋กœ ์ด๋™ํ•˜๋Š” ๋กœ์ง์„ ๊ตฌํ˜„ํ•ด๋ณด๋ ค ํ•œ๋‹ค.

    ๊ทธ ์ „์— ๋กœ๊ทธ์ธ ์ฒ˜๋ฆฌ ๊ณผ์ •์ด ์–ด๋–ป๊ฒŒ ๋˜๋Š”์ง€๋ถ€ํ„ฐ ์ •๋ฆฌํ•ด๋ณด์ž

    Unable to instantiate acitivity ์—๋Ÿฌ

     java.lang.RuntimeException: Unable to instantiate activity ComponentInfo{com.teamfilmo.filmo/com.teamfilmo.filmo.ui.auth.AuthActivity}: java.lang.InstantiationException: java.lang.Class<com.teamfilmo.filmo.ui.auth.AuthActivity> has no zero argument constructor

     

    ์ง€์†์ ์œผ๋กœ ํ•ด๋‹น ์—๋Ÿฌ๊ฐ€ ๋ฐœ์ƒํ•˜์˜€๋‹ค. ํŠนํžˆ ํ† ํฐ ์—ฌ๋ถ€๋ฅผ ์ฒดํฌํ•ด์ฃผ๊ธฐ ์œ„ํ•ด ๊ด€๋ จ ์ธํ„ฐํŽ˜์ด์Šค๋ฅผ ์ƒ์„ฑ์ž ์ฃผ์ž…ํ•ด์ค„ ๊ฒฝ์šฐ ์—๋Ÿฌ๊ฐ€ ๋ฐœ์ƒํ•˜์˜€๊ณ , ํ•„๋“œ ์‚ฝ์ž…์˜ ํ˜•ํƒœ๋กœ ์ž‘์„ฑํ•ด์ฃผ์—ˆ๋‹ค.

    ๋กœ๊ทธ์ธ ํ† ํฐ ์ €์žฅ ๋กœ์ง ์ถ”๊ฐ€

     

    ํ™•์ธ์„ ํ•ด๋ณธ ๊ฒฐ๊ณผ ๋กœ๊ทธ์ธ ์„ฑ๊ณตํ–ˆ์„ ๋•Œ ์‘๋‹ต๊ฐ’์œผ๋กœ ๋ฐ›์€ access token๊ณผ refresh token์„ ์ €์žฅํ•˜๋Š” ๋กœ์ง์ด ์•„์ง ๊ตฌํ˜„๋˜์–ด์žˆ์ง€ ์•Š์•˜๋‹ค.

    ๋”ฐ๋ผ์„œ ํ•ด๋‹น ๋กœ์ง๋ถ€ํ„ฐ ๊ตฌํ˜„ํ•ด๋ณด์•˜๋‹ค.

     

    ๋กœ๊ทธ์ธ ์„ฑ๊ณต ์‹œ ์‘๋‹ต๊ฐ’์œผ๋กœ ์˜ค๋Š” access token๊ณผ refresh token์„ datastore์— ์ €์žฅํ•˜๋Š” ๋กœ์ง์„ ๊ตฌํ˜„ ํ›„ ๋กœ๊ทธ๋ฅผ ์ฐ์–ด์ฃผ์—ˆ์ง€๋งŒ ๋กœ๊ทธ๊ฐ€ ์ฐํžˆ์ง€ ์•Š์•˜๋”ฐ..!! 

     

    ์•„๋ž˜ ์—๋Ÿฌ๋“ค์ด ๋ฐœ์ƒํ•˜๊ณ  ์žˆ์—ˆ๋‹ค.

    at com.android.okhttp.internal.huc.HttpURLConnectionImpl.getInputStream(HttpURLConnectionImpl.java:255)
    at com.android.okhttp.internal.huc.DelegatingHttpsURLConnection.getInputStream(DelegatingHttpsURLConnection.java:211)
    at com.android.okhttp.internal.huc.HttpsURLConnectionImpl.getInputStream(HttpsURLConnectionImpl.java:30)

     

    ์—๋Ÿฌ๋ฅผ ๊ตฌ๊ธ€๋งํ•ด๋ณด๋‹ˆ ํ—ค๋”์— ์•ฑ ํ‚ค๊ฐ€ ์ œ๋Œ€๋กœ ๋„˜์–ด๊ฐ€๊ณ  ์žˆ๋Š”์ง€ ํ™•์ธ์ด ํ•„์š”ํ•˜๋‹ค๊ณ  ํ•˜์˜€๋‹ค.

     

    ์‚ฌ์šฉ์ž์˜ ํ† ํฐ์„ ์ €์žฅํ•œ ํŒŒ์ผ์ด ์—†๋‹ค๋Š” ์—๋Ÿฌ์™€ ํ•จ๊ป˜ FileNotFound ์—๋Ÿฌ๊ฐ€ ๋ฐœ์ƒํ•˜๊ณ  ์žˆ๋”ฐ.

    @Serializable

    Caused by: kotlinx.serialization.SerializationException: Serializer for class 'AuthResponse' is not found.
                                                                                                        Please ensure that class is marked as '@Serializable' and that the serialization compiler plugin is applied.

     

    ํ† ํฐ ์ €์žฅ ์™„๋ฃŒ!! 

     

    ๋“œ๋””์–ด ํ† ํฐ์ด ์ €์žฅ๋˜์—ˆ๋‹ค.

    ๊ทธ๋ž˜์„œ ์ด์ œ ๋กœ๊ทธ์ธ ํ™”๋ฉด์—์„œ ๋กœ๊ทธ์ธ์— ์„ฑ๊ณตํ•ด์„œ ํ† ํฐ์ด ์žˆ์„ ๊ฒฝ์šฐ์—๋Š” ๋ฉ”์ธ ํ™”๋ฉด์œผ๋กœ ๋„˜์–ด๊ฐ€๋„๋ก ์ฝ”๋“œ๋ฅผ ์ž‘์„ฑํ•ด์ฃผ์—ˆ๋‹ค.

    ํ•˜์ง€๋งŒ ๋˜ ์•„๋ž˜ ์—๋Ÿฌ๊ฐ€ ๋ฐœ์ƒํ–ˆ๋‹ค. ๐Ÿ˜ญ

     


    ์•กํ‹ฐ๋น„ํ‹ฐ๋ฅผ ๊ฐ์ฒดํ™”ํ•  ์ˆ˜ ์—†๋‹ค๋Š” ์—๋Ÿฌ (ํ•ด๊ฒฐ)

    ์•„๋ž˜ ์ฝ”๋“œ์—์„œ ๋ฌธ์ œ๊ฐ€ ์žˆ์—ˆ๋‹ค.

    ๋ฉ˜ํ†  ๊ฐœ๋ฐœ์ž๋‹˜๊ป˜ ํ•ด๋‹น ์—๋Ÿฌ๋ฅผ ๊ณต์œ ํ•˜์˜€๊ณ  ์•กํ‹ฐ๋น„ํ‹ฐ์—์„œ๋Š” ์ƒ์„ฑ์ž ์‚ฝ์ž…์ด ๋ถˆ๊ฐ€๋Šฅํ•˜๋‹ค๋Š” ๊ฒƒ์„ ๋ฐฐ์› ๋‹ค!!!

    @AndroidEntryPoint
    class AuthActivity
        @Inject
        constructor(
            private val userTokenSource: UserTokenSource,
        ) :
    java.lang.RuntimeException: Unable to instantiate activity ComponentInfo{com.teamfilmo.filmo/com.teamfilmo.filmo.ui.auth.AuthActivity}: java.lang.InstantiationException: java.lang.Class<com.teamfilmo.filmo.ui.auth.AuthActivity> has no zero argument constructor

     

    // ์ˆ˜์ •ํ•œ ์ฝ”๋“œ

     

    ๋‹ค์‹œ ์ •์ƒ ์ž‘๋™ํ•˜์˜€๋‹ค.

    ์ด์ œ ๋กœ๊ทธ์ธ ๋ฒ„ํŠผ์„ ๋ˆ„๋ฅด๋ฉด ์„œ๋ฒ„์—์„œ ๋ฐ›์€ access token์ด datastore์„ ํ†ตํ•ด user_token.pb ์ด๋ฆ„์œผ๋กœ ์ €์žฅ๋˜๊ณ  ์žˆ๋‹ค.

     

    ์ด์ œ๋Š” ๋กœ๊ทธ์ธ ํ™”๋ฉด ์‹œ ๋กœ๊ทธ์ธ์— ์„ฑ๊ณตํ•˜๋ฉด ๋ฉ”์ธ ํ™”๋ฉด์œผ๋กœ ๋„˜์–ด๊ฐ€๋Š” ๋กœ์ง์„ ๊ตฌํ˜„ํ•ด๋ณด์ž! 

    ์ƒ๊ฐํ•ด๋ณด๋‹ˆ ์œ„์—์„œ ๊ตฌํ˜„ํ•ด์ค€ ๋กœ์ง์—๋Š” ๋ฌธ์ œ๊ฐ€ ์žˆ์—ˆ๋‹ค.

     

    ๋กœ๊ทธ์ธ ๋ฒ„ํŠผ ํด๋ฆญ ์‹œ ๋กœ๊ทธ์ธ์ด ์„ฑ๊ณตํ•˜๋ฉด ๋ฉ”์ธ ํ™”๋ฉด์œผ๋กœ ๋„˜์–ด๊ฐ€์•ผํ•จ

     

    - ๊ทผ๋ฐ ๋กœ๊ทธ์ธ ์‹œ ๋งค๋ฒˆ access token์„ ์ €์žฅํ•ด์•ผํ•˜๋‚˜?

     

    ๐Ÿ’กํ† ํฐ ์ฒ˜๋ฆฌํ•˜๊ธฐ (์ฝ”๋“œ ์ˆ˜์ •)

    ํ˜„์žฌ๋Š” ๋ฉ”์ธ์•กํ‹ฐ๋น„ํ‹ฐ์—์„œ userTokenSource ๊ฐ์ฒด๋ฅผ ์ฐธ์กฐํ•˜์—ฌ ํ† ํฐ์„ ํ™•์ธํ•ด์ฃผ๊ณ  ์žˆ๋‹ค. ์ด๋กœ์ง์€ ์ด๋™์‹œ์ผœ์ฃผ๋ คํ•œ๋‹ค.

     

    ์ด์œ  ! 

    -> ์ •๋ฆฌํ•˜๊ธฐ 

     

    ๋ฉ”์ธ ํ™”๋ฉด๊ณผ ์—ฐ๊ฒฐ์„ ํ–ˆ๋”๋‹ˆ ์ด์ œ๋Š” ๊ฐ์ƒ๋ฌธ ๋ฆฌ์‚ฌ์ดํด๋Ÿฌ๋ทฐ ๋ชฉ๋ก์ด ๋œจ์ง€ ์•Š๋Š”๋‹ค. ๋ฌด์Šจ ๋ฌธ์ œ๊ฐ€ ์žˆ์„๊นŒ ๋กœ๊ทธ๋ฅผ ํ™•์ธํ•˜์˜€๋”๋‹ˆ!  ์•„๋ž˜์˜ ์—๋Ÿฌ๊ฐ€ ๋ฐœ์ƒํ•˜๊ณ  ์žˆ์—ˆ๋‹ค. 

     

    ์•„๋ž˜ ๋ธ”๋กœ๊ทธ๊ธ€์—์„œ ํ•ด๋‹น ์—๋Ÿฌ๋ฅผ ํ•ด๊ฒฐํ•˜๋Š” ๊ณผ์ •์„ ๊ธฐ๋กํ•ด๋‘์—ˆ๋‹ค.

     

    Android Recyclerview : no attached adapter , skipping layout ์—๋Ÿฌ ํ•ด๊ฒฐ ๊ณผ์ • ๊ธฐ๋ก

    ๐Ÿ”Ž๋ฌธ์ œ ์ƒํ™ฉ๋ฉ”์ธ ํ™”๋ฉด์ด ๋‚˜ํƒ€๋‚  ๋•Œ ๋ฆฌ์‚ฌ์ดํด๋Ÿฌ๋ทฐ๊ฐ€ ๋ณด์ด์ง€ ์•Š๋Š”๋‹ค.๐Ÿซฑ์‹œ๋„ํ•œ ๋ฐฉ๋ฒ•๊ตฌ๊ธ€๋ง์„ ํ†ตํ•ด ๋ช‡๊ฐ€์ง€ ์›์ธ์„ ํŒŒ์•…ํ•  ์ˆ˜ ์žˆ์—ˆ๊ณ , ํ•ด๋‹น ๋‚ด์šฉ์— ๋”ฐ๋ผ ์ฝ”๋“œ๋ฅผ ํ™•์ธํ•ด๋ณด์•˜๋‹ค.1๏ธโƒฃsetAdapter๊ฐ€ ์ž˜ ๋˜

    hyeonhahaha.tistory.com

    728x90