Хочу использовать xml верстку и Compose в одном проекте, посмотреть как они вместе сочетаются. Но есть проблема, когда я добавляю в зависимости
implementation 'com.google.android.material:material:1.7.0'
вылетает ошибка
android material gradle/caches/modules-2/files-2.1/org.jetbrains.kotlin/kotlin-stdlib-common/1.7.10/bac80c520d0a9e3f3673bc2658c6ed02ef45a76a/kotlin-stdlib-common-1.7.10.jar!/meta-inf/kotlin-stdlib-common.kotlin_module: module was compiled with an incompatible version of kotlin. the binary version of its metadata is 1.7.1, expected version is 1.5.1.
Не могу найти место, где нужно поправить, чтобы проект собрался.
plugins {
id 'com.android.application'
id 'org.jetbrains.kotlin.android'
id 'kotlin-kapt'
id("kotlin-parcelize")
}
android {
compileSdk 32
defaultConfig {
applicationId
minSdk 21
targetSdk 32
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
}
viewBinding {
enabled = true
}
composeOptions {
kotlinCompilerExtensionVersion compose_version
}
packagingOptions {
resources {
excludes += '/META-INF/{AL2.0,LGPL2.1}'
}
}
}
dependencies {
implementation 'androidx.cardview:cardview:1.0.0'
implementation 'androidx.constraintlayout:constraintlayout:2.1.4'
def nav_version = "2.5.3"
implementation("androidx.navigation:navigation-compose:$nav_version")
implementation "androidx.lifecycle:lifecycle-viewmodel-compose:2.5.1"
implementation "androidx.compose.material:material-icons-extended:$compose_version"
implementation 'androidx.core:core-ktx:1.7.0'
implementation "androidx.compose.ui:ui:$compose_version"
implementation "androidx.compose.material:material:$compose_version"
implementation "androidx.compose.ui:ui-tooling-preview:$compose_version"
implementation 'androidx.lifecycle:lifecycle-runtime-ktx:2.3.1'
implementation 'androidx.activity:activity-compose:1.3.1'
testImplementation 'junit:junit:4.13.2'
androidTestImplementation 'androidx.test.ext:junit:1.1.4'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.5.0'
androidTestImplementation "androidx.compose.ui:ui-test-junit4:$compose_version"
debugImplementation "androidx.compose.ui:ui-tooling:$compose_version"
debugImplementation "androidx.compose.ui:ui-test-manifest:$compose_version"
}
pluginManagement {
repositories {
gradlePluginPortal()
google()
mavenCentral()
}
}
dependencyResolutionManagement {
repositoriesMode.set(RepositoriesMode.FAIL_ON_PROJECT_REPOS)
repositories {
google()
mavenCentral()
}
}
rootProject.name = "Jetpack Compose Test"
include ':app'
// build.gradle (project)
buildscript {
ext {
compose_version = '1.1.0-beta01'
}
}
// Top-level build file where you can add configuration options common
to all sub-projects/modules.
plugins {
id 'com.android.application' version '7.2.2' apply false
id 'com.android.library' version '7.2.2' apply false
id 'org.jetbrains.kotlin.android' version '1.5.31' apply false
}
task clean(type: Delete) {
delete rootProject.buildDir
}
Как я понял, зависимость
implementation 'com.google.android.material:material:1.7.0'
требует в build.gradle (project) установить
plugins { id 'org.jetbrains.kotlin.android' version '1.7.21' apply false }
но тогда появляется другая ошибка с совместимостью compose. В итоге я оставил в проекте более старую версию material ->
'com.google.android.material:material:1.4.0'
теперь проект собирается, но когда дохожу до фрагмента compose с material компонентами ловлю краш
build.gradle
файл. Отредактировать вопрос можно, нажав на кнопку править под вопросом.