Android-jetpack Compose

jackpack compose - Android Studio 설정

slow333 2023. 3. 18. 10:43

gradle 설정

buildscript {
    ext {
//        compose_ui_version = '1.4.0'
        compose_ui_version = '1.3.3'  -> 이 버전은 별도 임 => 문서 확인
    }

plugins {
    id 'com.android.application' version '7.4.2' apply false
    id 'com.android.library' version '7.4.2' apply false
    id 'org.jetbrains.kotlin.android' version '1.8.10' apply false   => 이게 코트린 버전임

}

    composeOptions {
        kotlinCompilerExtensionVersion '1.4.3'      => 코트린 버전과 맞아야함(1.8.10에 맞는 것)
//        kotlinCompilerExtensionVersion '1.2.0'    => 코트린 버전과 맞아야함(1.7.0에 맞는 것)
    }

 

코트린 1.8.10(현재 최신 2023.3)에 서 나머지는 모두 최신 버전으로하면됨

=========== 설정 내용===========

build.gradle(Project ....)

buildscript {
    ext {
        compose_ui_version = '1.3.3'
    }
}
plugins {
    id 'com.android.application' version '7.4.2' apply false
    id 'com.android.library' version '7.4.2' apply false
    id 'org.jetbrains.kotlin.android' version '1.8.10' apply false
}

 

build.gradle(module.app)

plugins {
    id 'com.android.application'
    id 'org.jetbrains.kotlin.android'
}

android {
    namespace 'video.bootcamp.viewmodelhoistingnoteapp'
    compileSdk 33

    defaultConfig {
        applicationId "video.bootcamp.viewmodelhoistingnoteapp"
        minSdk 30
        targetSdk 33
        versionCode 1
        versionName "1.0"

        testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
        vectorDrawables {
            useSupportLibrary true
        }
    }

    buildTypes {
        release {
            minifyEnabled 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 {
        compose true
    }
    composeOptions {
        kotlinCompilerExtensionVersion '1.4.3'
    }
    packagingOptions {
        resources {
            excludes += '/META-INF/{AL2.0,LGPL2.1}'
        }
    }
}

dependencies {

    implementation 'androidx.core:core-ktx:1.9.0'
    implementation 'androidx.lifecycle:lifecycle-runtime-ktx:2.6.1'
    implementation 'androidx.activity:activity-compose:1.7.0'
    implementation "androidx.compose.ui:ui:$compose_ui_version"
    implementation "androidx.compose.ui:ui-tooling-preview:$compose_ui_version"
    implementation 'androidx.compose.material:material:1.4.0'
    testImplementation 'junit:junit:4.13.2'
    androidTestImplementation 'androidx.test.ext:junit:1.1.5'
    androidTestImplementation 'androidx.test.espresso:espresso-core:3.5.1'
    androidTestImplementation "androidx.compose.ui:ui-test-junit4:$compose_ui_version"
    debugImplementation "androidx.compose.ui:ui-tooling:$compose_ui_version"
    debugImplementation "androidx.compose.ui:ui-test-manifest:$compose_ui_version"

    //Icons
    implementation "androidx.compose.material:material-icons-extended:1.4.0"

    // navigation
    implementation "androidx.navigation:navigation-compose:2.5.3"

    // coil
    implementation "io.coil-kt:coil-compose:2.2.2"
}