핀수로그
  • [Android] 프로젝트 셋팅을 하며 생긴 오류 해결하기
    2023년 10월 01일 11시 57분 18초에 업로드 된 글입니다.
    작성자: 핀수
    728x90
    반응형

    집단지성의 방 해커톤을 진행하기 위해 프로젝트 셋팅을 먼저 했다.

    (해커톤에 대한 것이 궁금하다면 아래 링크 참고)

     

    집단지성의 방 : 1st Hackathon - Deep Into the Code

    작년에 왔던 집단지성의 방(이하 집지방), 죽지도 않고 올해 또 왔습니다. 😂 사실 작년에 비해 올해는 활발한 활동을 이어나가진 못했습니다. 혈기왕성 열정만땅이었던 신입에서 어딘가 한풀

    www.pinslog.com

    프로젝트를 셋팅하면서 만난 오류와 해결 방법에 대해 간략하게 기록하려고 한다.

     

    프로젝트 셋팅

    안스 업데이트 이후 (지라프) 프로젝트를 생성하려고 하니 몇가지 눈에 띄는 점들이 있다.

    Activity를 선택할 때는 컴포즈가 가장 상단에 위치해있고, 선택지가 많이 간소화되었다고 느껴졌다.

    그리고 Build 셋팅 언어를 선택하는걸..난 지금 처음 본 것 같은데..?!

    Kotlin DSL을 권장하는 것을 보고 놀랐다. 난 그루비 밖에 모른다고 이놈들아

    이왕 만드는거 넘어가봐야 하나…………고민이 된다.

    코틀린 이놈들 멀티 플랫폼에 진짜 진심인게 느껴진다는거지..

     

    음? 그루비에서 코틀린 DSL로 이전하는 것이 가능하다고 하니 일단은 그루비로 쓰겠습니다.

     

    프로젝트 생성

    뭣모르고 안스와 AGP를 업데이트 해버리는 바람에 프로젝트가 Gradle 8.1? 버전으로 생성되어 버렸다.

    변경사항이 많은 상태에서 초기 셋팅을 진행하고 다른 사람들과 개발하려고 하면 문제가 생길 것 같아

    버전을 7.4.2로 내렸다.

     

    ♨️ Cannot use @TaskAction annotation on method AbstractKotlinCompile.execute() because interface org.gradle.api.tasks.incremental.IncrementalTaskInputs is not a valid parameter to an action method.

    프로젝트 수준 build.gradle

    원하는 버전 지정 후 sync now를 눌러 실행했더니 위와 같은 오류가 났다.

    plugins {
        id 'com.android.application' version '7.4.1' apply false
        id 'com.android.library' version '7.4.1' apply false
        id 'org.jetbrains.kotlin.android' version '1.5.31' apply false
    }

    gradle-wrapper.properties

    distributionBase=GRADLE_USER_HOME
    distributionPath=wrapper/dists
    distributionUrl=https\://services.gradle.org/distributions/gradle-8.0-bin.zip
    zipStoreBase=GRADLE_USER_HOME
    zipStorePath=wrapper/dists

    distributionURL이 가리키는 버전이 일치하지 않아 발생한 오류였다.

    아래 표를 참고해 7.5로 변경해주었더니 오류 없이 빌드 되었다.

    ♨️ e: java.lang.Error: Something went wrong while checking for version compatibility between the Compose Compiler and the Kotlin Compiler. It is possible that the versions are incompatible. Please verify your kotlin version and consult the Compose-Kotlin compatibility map located at https://developer.android.com/jetpack/androidx/releases/compose-kotlin

    프로젝트 수준 build.gradle

    plugins {
        id 'com.android.application' version '7.4.1' apply false
        id 'com.android.library' version '7.4.1' apply false
        id 'org.jetbrains.kotlin.android' version '1.5.31' apply false
    }

    앱 수준 build.gradle

    composeOptions {
            kotlinCompilerExtensionVersion '1.4.3'
        }

    코틀린 버전이 맞지 않아 발생한 오류

    아래의 표를 참고해 버전을 맞춰주어 해결


    공부하며 작성된 글이라 잘못된 정보가 있을 수 있습니다.

    말씀해주시면 수정하겠습니다. 감사합니다.

    References

    아래 글을 참고하여 작성 되었습니다.

     

    Groovy에서 KTS로 빌드 구성 이전  |  Android 개발자  |  Android Developers

    Gradle 구성 파일을 Groovy에서 KTS로 이전합니다.

    developer.android.com

     

     

     

    728x90
    반응형
    댓글