Невозможно загрузить класс «org.jetbrains.kotlin.gradle.dsl.KotlinJvmCompilerOptionsHelper».Android

Форум для тех, кто программирует под Android
Ответить Пред. темаСлед. тема
Anonymous
 Невозможно загрузить класс «org.jetbrains.kotlin.gradle.dsl.KotlinJvmCompilerOptionsHelper».

Сообщение Anonymous »

Я создал простой проект в AndroidStudio и добавил зависимости.
Android Studio Hedgehog | 2023.1.1 Canary 16
Java 17.0.7
также для gradle

libs.versions.toml

Код: Выделить всё

[versions]
agp = "8.1.0"
kotlin = "1.8.22"
ksp = "1.9.0-1.0.13"
hilt = "2.47"
core-ktx = "1.10.1"
junit = "4.13.2"
androidx-test-ext-junit = "1.1.5"
espresso-core = "3.5.1"
appcompat = "1.6.1"
material = "1.9.0"

[libraries]
core-ktx = { group = "androidx.core", name = "core-ktx", version.ref = "core-ktx" }
junit = { group = "junit", name = "junit", version.ref = "junit" }
androidx-test-ext-junit = { group = "androidx.test.ext", name = "junit", version.ref = "androidx-test-ext-junit" }
espresso-core = { group = "androidx.test.espresso", name = "espresso-core", version.ref = "espresso-core" }
appcompat = { group = "androidx.appcompat", name = "appcompat", version.ref = "appcompat" }
material = { group = "com.google.android.material", name = "material", version.ref = "material" }

[plugins]
androidApplication = { id = "com.android.application", version.ref = "agp" }
kotlinAndroid = { id = "org.jetbrains.kotlin.android", version.ref = "kotlin" }
daggerHilt = { id = "com.google.dagger.hilt.android", version.ref = "hilt" }
kotlinKsp = { id = "com.google.devtools.ksp", version.ref = "ksp"  }
build.gradle.kts в проекте[/b]

Код: Выделить всё

Top-level build file where you can add configuration options common to all sub-projects/modules.
@Suppress("DSL_SCOPE_VIOLATION") // TODO: Remove once KTIJ-19369 is fixed
plugins {
alias(libs.plugins.androidApplication) apply false
alias(libs.plugins.kotlinAndroid) apply false
alias(libs.plugins.kotlinKsp) apply false
alias(libs.plugins.daggerHilt) apply false

}
true // Needed to make the Suppress annotation work for the plugins block
build.gradle.kts в приложении модуля

Код: Выделить всё

@Suppress("DSL_SCOPE_VIOLATION") // TODO:  Remove once KTIJ-19369 is fixed
plugins {
alias(libs.plugins.androidApplication)
alias(libs.plugins.kotlinAndroid)
alias(libs.plugins.kotlinKsp)
alias(libs.plugins.daggerHilt)
}

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

defaultConfig {
applicationId = "com.example"
minSdk = 24
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_17
targetCompatibility = JavaVersion.VERSION_17
}
kotlinOptions {
jvmTarget = "17"
}
}

dependencies {

implementation(libs.core.ktx)
implementation(libs.appcompat)
implementation(libs.material)
testImplementation(libs.junit)
androidTestImplementation(libs.androidx.test.ext.junit)
androidTestImplementation(libs.espresso.core)

Material3
implementation "androidx.compose.material:material:$compose_version"
implementation("androidx.compose.material:material-icons-extended-android:1.5.0")

Compose
implementation("androidx.compose.ui:ui:1.5.0")
implementation("androidx.compose.ui:ui-tooling-preview:")
debugImplementation("androidx.compose.ui:ui-tooling:1.5.0")
debugImplementation("androidx.compose.ui:ui-test-manifest:1.5.0")
implementation("androidx.activity:activity-compose:1.7.2")

lifecycler
implementation("androidx.lifecycle:lifecycle-runtime-ktx:2.6.1")
implementation("androidx.lifecycle:lifecycle-runtime-compose:2.6.1")
implementation("androidx.lifecycle:lifecycle-viewmodel-compose:2.6.1")
implementation("androidx.navigation:navigation-compose:2.7.0")
implementation("androidx.hilt:hilt-navigation-compose:1.0.0")

Tests
androidTestImplementation("androidx.compose.ui:ui-test-junit4:1.5.0")

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

//Dagger - Hilt
implementation("androidx.hilt:hilt-android:2.47")
ksp("com.google.dagger:hilt-android-compiler:2.47")

Room Database
implementation("androidx.room:room-ktx:2.5.2")
ksp("androidx.room:room-compiler:2.5.2")
Kotlin Extensions and Coroutines support for Room
implementation("androidx.room:room-ktx:2.5.2")

androidTestImplementation("androidx.room:room-testing:2.5.2")
}
settings.gradle.kts

Код: Выделить всё

pluginManagement {
repositories {
google()
mavenCentral()
gradlePluginPortal()
>!     }
}
dependencyResolutionManagement {
repositoriesMode.set(RepositoriesMode.FAIL_ON_PROJECT_REPOS)
repositories {
google()
mavenCentral()
>!     }
}
>!
rootProject.name = "Example"
include(":app")
>!
gradle.properties:

Код: Выделить всё

org.gradle.jvmargs=-Xmx2048m -Dfile.encoding=UTF-8
android.useAndroidX=true
kotlin.code.style=official
android.nonTransitiveRClass=true
gradle-wrapper.properties:

Код: Выделить всё

distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-8.3-all.zip
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
И при синхронизации проекта возникает ошибка:


< ol>
[*]

Я попробовал и спросил ChatGPT :)

Код: Выделить всё

Variant 'apiElements' capability com.android.tools.build:gradle:8.1.0 declares a library, packaged as a jar, and its dependencies declared externally:
Incompatible because this component declares a component for use during compile-time, compatible with Java 11 and the consumer needed a component for use during runtime, compatible with Java 8
Other compatible attribute:
Doesn't say anything about org.gradle.plugin.api-version (required '8.3')
Variant 'javadocElements' capability com.android.tools.build:gradle:8.1.0 declares a component for use during runtime,  and its dependencies declared externally:
Incompatible because this component declares documentation and the consumer needed a library
Other compatible attributes:
Doesn't say anything about its target Java version (required compatibility with Java 8)
Doesn't say anything about its elements (required them packaged as a jar)
Doesn't say anything about org.gradle.plugin.api-version (required '8.3')
Variant 'runtimeElements' capability com.android.tools.build:gradle:8.1.0 declares a library for use during runtime, packaged as a jar, and its dependencies declared externally:
Incompatible because this component declares a component, compatible with Java 11 and the consumer needed a component, compatible with Java 8
Other compatible attribute:
Doesn't say anything about org.gradle.plugin.api-version (required '8.3')
Variant 'sourcesElements' capability com.android.tools.build:gradle:8.1.0 declares a component for use during runtime, and its dependencies declared externally:
Incompatible because this component declares documentation and the consumer needed a library
Other compatible attributes:
Doesn't say anything about its target Java version (required compatibility with Java 8)
Doesn't say anything about its elements (required them packaged as a jar)
Doesn't say anything about org.gradle.plugin.api-version (required '8.3')
  • Также пробовал понизить версию gradle и agp
  • очистил кеш gralde, а затем полностью удалил папку .gradle.
  • Перезапустил Android Studio и очистил весь кеш. p>
  • пробовал обновить версию с 1.8 до 17
  • Добавлены инструменты gradle, mavenCenter, зависимости Google
7) Я искал ответы на stackoverflow, github и других сайтах п>

Подробнее здесь: https://stackoverflow.com/questions/769 ... roptionshe
Реклама
Ответить Пред. темаСлед. тема

Быстрый ответ

Изменение регистра текста: 
Смайлики
:) :( :oops: :roll: :wink: :muza: :clever: :sorry: :angel: :read: *x)
Ещё смайлики…
   
К этому ответу прикреплено по крайней мере одно вложение.

Если вы не хотите добавлять вложения, оставьте поля пустыми.

Максимально разрешённый размер вложения: 15 МБ.

  • Похожие темы
    Ответы
    Просмотры
    Последнее сообщение
  • Невозможно найти метод void org.jetbrains.kotlin.gradle.dsl.KotlinJvmOptions.setUseIR(boolean)
    Anonymous » » в форуме JAVA
    0 Ответы
    10 Просмотры
    Последнее сообщение Anonymous
  • Невозможно найти метод void org.jetbrains.kotlin.gradle.dsl.KotlinJvmOptions.setUseIR(boolean)
    Anonymous » » в форуме JAVA
    0 Ответы
    11 Просмотры
    Последнее сообщение Anonymous
  • Невозможно найти метод void org.jetbrains.kotlin.gradle.dsl.KotlinJvmOptions.setUseIR(boolean)
    Anonymous » » в форуме JAVA
    0 Ответы
    10 Просмотры
    Последнее сообщение Anonymous
  • Невозможно найти метод void org.jetbrains.kotlin.gradle.dsl.KotlinJvmOptions.setUseIR(boolean)
    Anonymous » » в форуме JAVA
    0 Ответы
    8 Просмотры
    Последнее сообщение Anonymous
  • Невозможно найти метод void org.jetbrains.kotlin.gradle.dsl.kotlinjvmoptions.setuseir (boolean)
    Anonymous » » в форуме JAVA
    0 Ответы
    5 Просмотры
    Последнее сообщение Anonymous

Вернуться в «Android»