inflearn logo
강의

Course

Instructor

Frozen Coder's Easy Introduction to Modern Android Development

Practice2D - Display Search Results on UI (Coil, ListAdapter, SaveStateHandle)

moshi관련 질문입니다.

539

yeongjae oh

1 asked

0

plugins {
    id("com.android.application")
    id("org.jetbrains.kotlin.android")
    id("kotlin-kapt")
    id("com.google.android.libraries.mapsplatform.secrets-gradle-plugin")
}

android {
    namespace = "com.example.booksearchapp"
    compileSdk = 34

    defaultConfig {
        applicationId = "com.example.booksearchapp"
        minSdk = 23
        targetSdk = 34
        versionCode = 1
        versionName = "1.0"

        testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner"
    }

    buildTypes {
        release {
            isMinifyEnabled = false
            proguardFiles(
                getDefaultProguardFile("proguard-android-optimize.txt"),
                "proguard-rules.pro"
            )
        }
    }
    compileOptions {
        sourceCompatibility = JavaVersion.VERSION_1_8
        targetCompatibility = JavaVersion.VERSION_1_8
    }
    kotlinOptions {
        jvmTarget = "1.8"
    }
    buildFeatures {
        buildConfig = true
        viewBinding = true
    }
}

dependencies {

    implementation("androidx.core:core-ktx:1.12.0")
    implementation("androidx.appcompat:appcompat:1.6.1")
    implementation("com.google.android.material:material:1.11.0")
    implementation("androidx.constraintlayout:constraintlayout:2.1.4")
    implementation("androidx.legacy:legacy-support-v4:1.0.0")

    // Retrofit
    implementation("com.squareup.retrofit2:retrofit:2.9.0")
    implementation("com.squareup.retrofit2:converter-moshi:2.9.0")

    // Okhttp
    // define a BOM and its version
    implementation(platform("com.squareup.okhttp3:okhttp-bom:4.12.0"))
    // define any required OkHttp artifacts without version
    implementation("com.squareup.okhttp3:okhttp")
    implementation("com.squareup.okhttp3:logging-interceptor")

    // Moshi
    implementation("com.squareup.moshi:moshi-kotlin:1.14.0")
    kapt("com.squareup.moshi:moshi-kotlin-codegen:1.14.0")

    // Lifrcycle
    implementation("androidx.lifecycle:lifecycle-viewmodel-ktx:2.7.0")
    implementation("androidx.lifecycle:lifecycle-runtime-ktx:2.7.0")
    implementation("androidx.lifecycle:lifecycle-viewmodel-savedstate:2.7.0")

    // Coroutines
    implementation("org.jetbrains.kotlinx:kotlinx-coroutines-core:1.7.3")
    implementation("org.jetbrains.kotlinx:kotlinx-coroutines-android:1.7.3")

    // Coil
    implementation("io.coil-kt:coil:2.5.0")

    // RecyclerView
    implementation("androidx.recyclerview:recyclerview:1.3.2")

    testImplementation("junit:junit:4.13.2")
    androidTestImplementation("androidx.test.ext:junit:1.1.5")
    androidTestImplementation("androidx.test.espresso:espresso-core:3.5.1")
}

위처럼 설정을 하고 빌드를 할때 아래와 같은 에러가 발생합니다.

Execution failed for task ':app:kaptDebugKotlin'.

> A failure occurred while executing org.jetbrains.kotlin.gradle.internal.KaptWithoutKotlincTask$KaptExecutionWorkAction

> java.lang.reflect.InvocationTargetException (no error message)

jdk는 17을 사용하고 있습니다.

11로 설정하면 아래와 같은 에러가 나옵니다.
is project is configured to use an older Gradle JVM that supports up to version 11 but the current AGP requires a Gradle JVM that supports version 17.

 

어느 부분을 수정해야될 지 모르겠습니다.. ㅜㅜ

android kotlin 아키텍처 jetpack

Answer 2

0

frozencoder

확인해 봤는데 codegen 버전을 업그레이드했더니 정상적으로 빌드됩니다 :-)

kapt("com.squareup.moshi:moshi-kotlin-codegen:1.15.0")

0

yeongjae oh

해당 안드로이드 파일 공유드립니다.

https://drive.google.com/file/d/1rZGfDRcOH00pisVl9Rrm6poDS-bbrr0T/view?usp=sharing

Coroutine, Flow 질문

0

379

1

Transformations import 안됨

0

570

1

searchBooks() 에서 북 검색 입력을 너무 빨리 할 경우 마지막 글자로 검색이 안돼요.

0

352

1

안드로이드에서 아키텍처 패턴

0

403

1

RecyclerView.Adapter vs ListAdpater

0

459

1

Flows 와 Coroutine

1

554

1

[BookSearchAdapter] onBindViewHolder의 currentList[position] 질문

0

357

1

코루틴 메모리 관련해서 질문드립니다!

0

441

1

Java Bill Pugh Solution 에서 INSTANCE

0

457

1

nested json에서 특정 부분만 파싱하는법

0

484

1

Fragment에서의 viewBinding

0

511

3

toolbar 질문드립니다.

0

402

2

EditText 에서 delay 주셔서 처리하셨는데 flow 의 debounce() 하고 같은건가요?

2

559

1

코루틴 관련 질문

0

538

1

오류

1

488

2

강사님! 직렬화 라이브러리를 Moshi, kotlin serialization 두개를 사용하시던데 이유가 있으신가요?

1

737

1

EditText 는 kill 해도 값이 잘 저장되어있던데 혹시 제가 잘못테스트했을까요?

1

342

1

서버도 페이징 기능이 되는데 Paging 라이브러리가 필요할까요?

1

519

1

GSON 이 아닌 Moshi 를 사용하시는 이유가 있을까요?

1

1262

1

EditText 는 액티비티가 재생성되어도 값이 남아있던데 이유가 궁금해요

1

491

1

ViewModel 생성시 왜 초기값을 받지 않도록 했을까요?

1

431

1

Room DB에 id 항목 추가

0

246

1

안녕하세요. 용어에 대해 질문이 있어 글 남깁니다.

0

395

2

paging config pageSize 관련

0

421

1