๋ณธ๋ฌธ ๋ฐ”๋กœ๊ฐ€๊ธฐ

๐Ÿ“ฑ| Android55

java.lang.ClassNotFoundException: Didn't find class "com.example.community.MainActivity" ์˜ค๋Š˜์˜ ์—๋Ÿฌ๋Š” ๋ฐ”๋กœ ํด๋ž˜์Šค๋ฅผ ์ฐพ์„ ์ˆ˜ ์—†์„ ๋•Œ ๋œจ๋Š” ๋ฒ„๊ทธ๋ฅผ ํ•ด๊ฒฐํ•˜๋Š” ๋ฐฉ๋ฒ•์„ ์•Œ์•„๋ณด๊ฒ ๋‹ค. ์—๋Ÿฌ ๋ฌธ๊ตฌ java.lang.RuntimeException: Unable to instantiate activity ComponentInfo{com.example.community/com.example.community.MainActivity}: java.lang.ClassNotFoundException: Didn't find class "com.example.community.MainActivity" on path: DexPathList[[zip file "/data/app/~~Tv8GPXV34ciClaHYGt-_Gg==/com.example.community-9AL2Z2ybv12CTGrbGEP6mQ==/base.a.. 2022. 4. 19.
Plugin [id: 'dagger.hilt.android.plugin'] was not found in any of the following sources ์ด๋ฒˆ ์˜ค๋ฅ˜๋Š” dagger hilt๋ฅผ ์“ฐ๋Š” ์‚ฌ๋žŒ๋“ค์—๊ฒŒ ๋‚˜ํƒ€๋‚ ์ˆ˜ ์žˆ๋Š” ์˜ค๋ฅ˜์ด๋‹ค ์˜ค๋ฅ˜ ๋ฌธ๊ตฌ * Exception is: org.gradle.api.plugins.UnknownPluginException: Plugin [id: 'dagger.hilt.android.plugin'] was not found in any of the following sources: - Gradle Core Plugins (plugin is not in 'org.gradle' namespace) - Plugin Repositories (plugin dependency must include a version number for this source) at org.gradle.plugin.use.internal.DefaultPlugi.. 2022. 4. 18.
[Android] ํ™”๋ฉด ์ด๋™ ๋ฐฉ๋ฒ• ์ •๋ฆฌ ์ด๋ฒˆ ์˜ˆ์ œ๋Š” ๋‚ด๊ฐ€ ์•Œ๊ณ  ์žˆ๋Š” ํ™”๋ฉด ์ „ํ™˜ ๋ฐฉ๋ฒ•๋“ค์— ๋Œ€ํ•ด ์ •๋ฆฌํ•ด๋ณด๊ฒ ๋‹ค. 1. intent๋ฅผ ์ด์šฉํ•œ ํ™”๋ฉด์ด๋™ intent๋ฅผ ์ด์šฉํ•˜๋Š” ๋ฐฉ๋ฒ•์€ ์ƒ๊ฐ๋ณด๋‹ค ๊ตฌ๊ธ€์— ๋งŽ์ด ๋‚˜์™€์žˆ์–ด ์‰ฝ๊ฒŒ ์•Œ์•„๋‚ผ์ˆ˜ ์žˆ๋‹ค. // ๊ฐ€์žฅ ๊ธฐ๋ณธ์ ์ธ intent ์‚ฌ์šฉ ๋ฐฉ๋ฒ• val intent = Intent(this, SecondActivity::class.java) startActivity(intent) ์ด๊ฑด ๊ฐ€์žฅ ๊ธฐ๋ณธ์ ์ธ intent ์‚ฌ์šฉ๋ฒ•์ด๋‹ค. ๊ทธ๋ฆฌ๊ณ  ์ € ์˜ˆ์ œ ์ฝ”๋“œ๋Š” startActivity(this, SecondActivity::class.java)๋กœ ๋ฐ”๊ฟ” ์“ธ์ˆ˜ ์žˆ๋‹ค. 1-1. putExtra putExtra๋Š” intent๋ฅผ ์‚ฌ์šฉํ• ๋•Œ ๋ฐ์ดํ„ฐ๋ฅผ ๋ณด๋‚ด๋Š” ๋ฉ”์„œ๋“œ๋กœ, ๋‹ค์Œ๊ณผ ๊ฐ™์ด ์‚ฌ์šฉํ• ์ˆ˜ ์žˆ๋‹ค. class MainActivity: Appcompat.. 2022. 4. 12.
[Android] Room ์‚ฌ์šฉ๋ฒ•๊ณผ RecyclerView๋ฅผ ํ™œ์šฉํ•œ ์˜ˆ์ œ ์ด๋ฒˆ ์˜ˆ์ œ๋Š” ์•ˆ๋“œ๋กœ์ด๋“œ์˜ ๊ฐ€์ƒ ๋ฐ์ดํ„ฐ๋ฒ ์ด์Šค์ธ room์„ ํ™œ์šฉํ•ด ๋ฐ์ดํ„ฐ๋ฅผ ์ €์žฅํ•˜๊ณ , ๊ทธ๊ฒƒ์„ recyclerview์— ๋ณด์ด๊ฒŒ ํ•˜๋Š” ์˜ˆ์ œ๋ฅผ ํ•ด๋ณด๊ฒ ๋‹ค. room ์„ ์‚ฌ์šฉํ•˜๊ธฐ ์œ„ํ•ด์„œ๋Š” ๋จผ์ € gradle์— ์ถ”๊ฐ€๋ฅผ ํ•ด์ค˜์•ผ ํ•œ๋‹ค. build.gradle(app) plugins { id 'kotlin-kapt' ... } android { ... } dependencies { implementation "androidx.room:room-runtime:2.4.2" kapt "androidx.room:room-compiler:2.4.2" } ์ถ”๊ฐ€๋ฅผ ํ•˜๊ณ  ๋‚˜์„œ, ๋ฐ์ดํ„ฐ๋ฒ ์ด์Šค์— ๋“ค์–ด๊ฐˆ ๋ฐ์ดํ„ฐ๋“ค์„ ๋งŒ๋“ค์ค˜์•ผ ํ•œ๋‹ค. 1. ๋ฐ์ดํ„ฐ๋ฒ ์ด์Šค ๊ฐœ์ฒด ํด๋ž˜์Šค ์ƒ์„ฑ @Entity(tableName = "chat_table") class Chat.. 2022. 4. 12.
[Android] Room์—์„œ ๋ฐ์ดํ„ฐ ๋ฌด๊ฒฐ์„ฑ์„ ํ™•์ธํ•  ์ˆ˜ ์—†์Šต๋‹ˆ๋‹ค. ํ•„์ž๋Š” room์„ ์ด์šฉํ•œ ์˜ˆ์ œ๋ฅผ ๋งŒ๋“ค๋‹ค๊ฐ€ ํ•œ ์˜ค๋ฅ˜๋ฅผ ๋งŒ๋‚ฌ๋‹ค. ์˜ค๋ฅ˜ ์ฝ”๋“œ java.lang.IllegalStateException: Room cannot verify the data integrity. Looks like you've changed schema but forgot to update the version number. You can simply fix this by increasing the version number. ๋ฒˆ์—ญ์„ ํ•˜๋ฉด Room์—์„œ ๋ฐ์ดํ„ฐ ๋ฌด๊ฒฐ์„ฑ์„ ํ™•์ธํ•  ์ˆ˜ ์—†์Šต๋‹ˆ๋‹ค. ์Šคํ‚ค๋งˆ๋ฅผ ๋ณ€๊ฒฝํ–ˆ์ง€๋งŒ ๋ฒ„์ „ ๋ฒˆํ˜ธ๋ฅผ ์—…๋ฐ์ดํŠธํ•˜๋Š” ๊ฒƒ์„ ์žŠ์€ ๊ฒƒ ๊ฐ™์Šต๋‹ˆ๋‹ค. ๋ฒ„์ „ ๋ฒˆํ˜ธ๋ฅผ ๋Š˜๋ฆฌ๋ฉด ๊ฐ„๋‹จํžˆ ํ•ด๊ฒฐํ•  ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค. ๋ผ๊ณ  ํ•ด์„œ ๋ฒ„์ „ ๋ฒˆํ˜ธ๋ฅผ ๋ฐ”๊ฟ”๋ณด์•˜๋‹ค. ๊ธฐ์กด ์ฝ”๋“œ @Database(entities = [UserE.. 2022. 4. 11.
[Android Kotlin] radio button ์˜ˆ์ œ ์˜ค๋Š˜์€ ๋‚ด๊ฐ€ ๋งŒ๋“ค๊ณ  ์žˆ๋Š” ํ”„๋กœ์ ํŠธ์—์„œ ์ƒˆ๋กœ ์•Œ๊ฒŒ ๋œ radio button ์ด ํด๋ฆญ๋œ ๊ฒƒ์˜ ํ…์ŠคํŠธ๋ฅผ ๊ฐ€์ ธ์™€์„œ textView์— ๋ณด์—ฌ์ฃผ๋Š” ์˜ˆ์ œ๋ฅผ ๋งŒ๋“ค์–ด ๋ณด๊ฒ ๋‹ค. ๋จผ์ € ๋‚˜๋Š” ์ปค์Šคํ…€ ๋‹ค์ด์–ผ๋กœ๊ทธ๋ฅผ ์‚ฌ์šฉํ•˜๊ณ , ๊ทธ๊ฒƒ์„ view binding์„ ํ†ตํ•ด ์˜ˆ์ œ๋ฅผ ๋งŒ๋“ค์—ˆ๊ธฐ ๋•Œ๋ฌธ์— build.gradle์— ์ถ”๊ฐ€๋ฅผ ํ•ด๋ณด๋„๋ก ํ•˜๊ฒ ๋‹ค. build.gradle(app) plugin { ... } android { ... buildFeatures { viewBinding = true } } dependencies { .... } ๋ทฐ ๋ฐ”์ธ๋”ฉ์— ๋Œ€ํ•œ ๋ฐฉ๋ฒ•์€ ์—ฌ๊ธฐ์„œ ์ž์„ธํžˆ ์•Œ๋ ค์ฃผ์ง€ ์•Š์„ ๊ฒƒ์ด๊ธฐ ๋•Œ๋ฌธ์— ๋ฏธ๋ฆฌ ๊ณต๋ถ€ํ•˜๊ณ  ์˜ค์‹œ๊ธธ ๋ฐ”๋ž€๋‹ค. ๊ทธ ๋‹ค์Œ dialog์— ์“ฐ์ผ ๋ ˆ์ด์•„์›ƒ์„ ๋งŒ๋“ค์–ด ์ฃผ๋„๋ก ํ•˜์ž custom_dualog_set_standard.x.. 2022. 4. 11.
[Android] com.google.gson.JsonParseException ํ•ด๊ฒฐ ์˜ค๋Š˜์€ ๋‚ด๊ฐ€ 5์‹œ๊ฐ„๋™์•ˆ ํ—ค๋ฉจ๋˜ ์˜ค๋ฅ˜์— ๋Œ€ํ•ด ํฌ์ŠคํŒ…์„ ๋‚จ๊ธฐ๊ฒ ๋‹ค. ๋‚˜๋Š” ๊นƒํ—ˆ๋ธŒ์— push ์‹ค์ˆ˜๋ฅผ ํ•ด์„œ ์–ด๋–ค ํŒŒ์ผ ํ•˜๋‚˜๋ฅผ git bash๋กœ ์‚ญ์ œํ–ˆ์—ˆ๋Š”๋ฐ... ๊ฐ‘์ž๊ธฐ ์•ˆ์Šค build gradle์ด ์•ˆ๋˜๋”๋‹ˆ ๋‹ค์Œ๊ณผ ๊ฐ™์€ ์˜ค๋ฅ˜๊ฐ€ ์ƒ๊ฒผ๋‹ค ์ฒ˜์Œ์—๋Š” ๊ฒ€์ƒ‰์„ ํ•ด์„œ ํ•ด๊ฒฐํ•˜๋ ค ํ–ˆ์ง€๋งŒ ๊ฒ€์ƒ‰ํ•ด์„œ ๋‚˜์˜ค๋Š” ๋ฐฉ๋ฒ•๋“ค์ด ๋ชจ๋‘ ๋‚˜ํ•œํ…Œ๋Š” ์•ˆ ๋˜์„œ ํ˜ผ์ž ๋ง‰ ํ”„๋กœ์ ํŠธ ์„ค์ •์„ ๊ฑด๋“œ๋ฆฌ๋‹ค ์šฐ์—ฐํžˆ(?) ํ•ด๊ฒฐํ–ˆ๋‹ค. ํ•ด๊ฒฐ ๋ฐฉ๋ฒ• File -> Settings Settings์—์„œ gradle์„ ๊ฒ€์ƒ‰ํ•˜๋ฉด ์ด๋Ÿฐ ํ™”๋ฉด์ด ๋œฌ๋‹ค. ๊ทธ ๋‹ค์Œ gradle user home์˜ ์ฃผ์†Œ๋ฅผ ๋ฐ”๊ฟ”๋ณด์•˜๋‹ค. ๊ทธ๋Ÿฐ๋ฐ ํ•ด๊ฒฐ์ด ๋๋‹ค. ์•„๋ฌดํŠผ ํ•ด๊ฒฐํ•˜๊ธด ํ–ˆ์œผ๋‚˜ ์ด๋ ‡๊ฒŒ ๊ฐ„๋‹จํžˆ ํ•ด๊ฒฐํ•ด์„œ ์•ฝ๊ฐ„ ํ˜„ํƒ€(?)๊ฐ€ ์™”์—ˆ๋‹ค.. 2022. 4. 3.
[Android] Clean Architecture ๊ธฐ๋ก ์˜ค๋Š˜์€ ๋‚ด๊ฐ€ Clean Architecture๋ฅผ ๊ณต๋ถ€ํ•œ ๋‚ด์šฉ์„ ์ •๋ฆฌํ•ด ๋ณด๋„๋ก ํ•˜๊ฒ ๋‹ค. Clean Architecture๋ž€? Clean Architecture๋Š” Robert C. Martin์ด๋ผ๋Š” ์‚ฌ๋žŒ์ด 2012๋…„์— ์ œ์‹œํ•œ ๊ฐœ๋…์œผ๋กœ, ๊ด€์‹ฌ์‚ฌ๋ฅผ ๋ถ„๋ฅ˜ํ•˜๋Š” ๊ฒƒ์ด ๋ชฉํ‘œ์ด๋‹ค. ์ด๋ ‡๊ฒŒ ๊ด€์‹ฌ์‚ฌ๋ฅผ ๋ถ„๋ฅ˜ํ•ด์„œ ์–ป๋Š” ์žฅ์ ์€ ํ”„๋กœ์ ํŠธ ์œ ์ง€, ๊ด€๋ฆฌ๊ฐ€ ์šฉ์ดํ•˜๋‹ค. ์ƒˆ๋กœ์šด ๊ธฐ๋Šฅ ์ ์šฉ์ด ๋นจ๋ผ์ง„๋‹ค. ํ…Œ์ŠคํŠธ ์ฝ”๋“œ ์ž‘์„ฑ์ด ์šฉ์ดํ•˜๋‹ค. ๋“ฑ ์—ฌ๋Ÿฌ ์žฅ์ ๋“ค์ด ์žˆ๋‹ค. ์•„๋ž˜์˜ ์‚ฌ์ง„์œผ๋กœ ํด๋ฆฐ ์•„ํ‚คํ…์ฒ˜์˜ ๊ตฌ์กฐ๋ฅผ ์‚ดํŽด๋ณด์ž ํด๋ฆฐ ์•„ํ‚คํ…์ฒ˜๋Š” 4๊ฐ€์ง€์˜ ๊ณ„์ธต์œผ๋กœ ๋ถ„๋ฅ˜๋œ๋‹ค. Entity User Cases Controllers UI ํด๋ฆฐ ์•„ํ‚คํ…์ฒ˜์˜ ๊ตฌ์กฐ๋ฅผ ๋ณด๋ฉด ๋ฐ”๊นฅ ๊ณ„์ธต์ด ์•ˆ์ชฝ ๊ณ„์ธต์— ์˜์กด์„ฑ์„ ๊ฐ€์ง€๋Š” ๊ฒƒ์„ ๋ณผ ์ˆ˜ ์žˆ๋‹ค. android ๊ธฐ์ค€์œผ๋กœ ๋ณด๊ธฐ์—๋Š” ์–ด๋ ค์›€์ด ์žˆ์–ด .. 2022. 4. 1.
[Android Kotlin] firebase fireStore, storage๋ฅผ ์ด์šฉํ•ด recyclerView๋กœ ์‚ฌ์ง„ ์ถœ๋ ฅํ•˜๊ธฐ ์•ˆ๋“œ๋กœ์ด๋“œ sns์•ฑ ๋งŒ๋“ค๋‹ค๊ฐ€ ์•Œ์•„๋‚ธ ๋ฐฉ๋ฒ•์„ ๊นŒ๋จน์—ˆ์–ด๋„ ๋‹ค์‹œ ๋ณผ ์ˆ˜ ์žˆ๊ฒŒ ์ด ํฌ์ŠคํŒ…์„ ์“ด๋‹ค. ์˜ค๋Š˜์€ firebase fireStore, storage๋ฅผ ์ด์šฉํ•ด recyclerView๋กœ ์‚ฌ์ง„ ์ถœ๋ ฅํ•˜๋Š” ๊ฒƒ์„ ํ•ด ๋ณด๊ฒ ๋‹ค. ๋จผ์ € storage์— ์‚ฌ์ง„์„ ์ถ”๊ฐ€ํ•ด๋ณด์•˜๋‹ค. ์ผ๋‹จ ๋‚˜๋Š” ๊ฒŒ์‹œ๊ธ€ ๋งŒ๋“ค๊ธฐ ๊ธฐ๋Šฅ์„ ๋งŒ๋“ค๋ฉด์„œ ๊ฒŒ์‹œ๊ธ€์— ์˜ฌ๋ฆฐ ์ด๋ฏธ์ง€๋“ค์„ ๋ชจ๋‘ images ํด๋”์— ๋„ฃ์—ˆ๊ณ , ๊ทธ๋ฆฌ๊ณ  ๊ทธ ํด๋” ์•ˆ์— ์‚ฌ์šฉ์ž์˜ uid๋ฅผ ๋‹ด์€ ํด๋”๋ฅผ ๋งŒ๋“ค์–ด์„œ ๊ทธ ์•ˆ์— ์ด๋ฏธ์ง€๋“ค์„ ์ €์žฅํ–ˆ๋‹ค. ๊ทธ ๋‹ค์Œ, firestore์— ๋ฐ์ดํ„ฐ๋“ค์„ ์ง‘์–ด๋„ฃ์„ ๋•Œ, ์‚ฌ์šฉ์ž์˜ uid์™€ ์ด๋ฏธ์ง€ ์ฃผ์†Œ๋ฅผ ๊ฐ™์ด ์ง‘์–ด๋„ฃ์—ˆ๋‹ค. ์™œ๋ƒํ•˜๋ฉด ์‚ฌ์šฉ์ž uid๊ฐ€ ๊ฐ™์œผ๋ฉด ์ด๋ฏธ์ง€์ฃผ์†Œ๋ฅผ ๋ฐ›์•„์™€ recyclerView์— ๋ณด์—ฌ์ฃผ๊ฒŒ ํ•  ๊ฒƒ์ด๊ธฐ ๋–„๋ฌธ์ด๋‹ค. firestore์™€ storage์— ๋ฐ์ดํ„ฐ๋ฅผ ๋„ฃ๋Š” .. 2022. 3. 31.
[Android] dagger hilt ๊ธฐ๋ก ์นœ๊ตฌ๋“ค๊ณผ ํ”„๋กœ์ ํŠธ๋ฅผ ํ•˜๋ฉด์„œ dagger hilt์— ๋Œ€ํ•œ ํ•„์š”์„ฑ์„ ๋Š๋ผ๊ณ  ์ด ํฌ์ŠคํŒ…์„ ์ž‘์„ฑํ•œ๋‹ค dagger hilt๋ž€? dagger hilt๋Š” ์•ˆ๋“œ๋กœ์ด๋“œ์—์„œ ํด๋ž˜์Šค๊ฐ„ ์˜์กด์„ฑ์„ ์ฃผ์ž…ํ• ์ˆ˜ ์žˆ๋Š” ๋ผ์ด๋ธŒ๋Ÿฌ๋ฆฌ์ด๋‹ค. dagger hilt๋ฅผ ์•Œ์•„๋ณด๊ธฐ ์ „์— ์ผ๋‹จ ์˜์กด์„ฑ์ด ๋ฌด์—‡์ธ์ง€ ๋ถ€ํ„ฐ ์•Œ์•„๋ณด์ž. ์˜์กด์„ฑ์ด๋ž€? ์˜์กด์„ฑ์ด๋ž€ ํด๋ž˜์Šค๊ฐ„ ์˜์กด ๊ด€๊ณ„๋ฅผ ๊ฐ€์ง€๋Š” ํ˜„์ƒ์„ ๋œปํ•œ๋‹ค. ์˜ˆ์‹œ class B { val id = "dltntlro" } class A { val data = B() } Aํด๋ž˜์Šค ๋‚ด๋ถ€์— Bํด๋ž˜์Šค ๊ฐ์ฒด๊ฐ€ ์ƒ์„ฑ๋˜์–ด ์žˆ์Œ(์˜์กด์ ์ž„)์„ ๋ณผ ์ˆ˜ ์žˆ๋‹ค ์ด๋Ÿฌํ•œ ์ƒํ™ฉ์ด ๋ฐœ์ƒํ•˜๋ฉด Aํด๋ž˜์Šค๊ฐ€ ํ˜ธ์ถœ๋ ๋•Œ๋งˆ๋‹ค Bํด๋ž˜์Šค๋„ ๊ณ„์† ์ƒ์„ฑ๋˜๊ธฐ ๋–„๋ฌธ์— ๋น„ํšจ์œจ์ ์ด๊ฒŒ ๋œ๋‹ค. ์ฃผ์ž…์ด๋ž€? ์ฃผ์ž…์ด๋ž€ ํด๋ž˜์Šค ์™ธ๋ถ€์—์„œ ๊ฐ์ฒด๋ฅผ ์ƒ์„ฑํ•˜๋Š” ๊ฒƒ์„ ๋งํ•œ๋‹ค. ์˜ˆ์‹œ 2 clas.. 2022. 3. 29.
728x90