Проблема с добавлением зависимостей для Kotlin Parcelize и KSP. Не удалось применить плагин «org.jetbrains.kotlin.androiAndroid

Форум для тех, кто программирует под Android
Ответить Пред. темаСлед. тема
Anonymous
 Проблема с добавлением зависимостей для Kotlin Parcelize и KSP. Не удалось применить плагин «org.jetbrains.kotlin.androi

Сообщение Anonymous »

Сообщение об ошибке

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

An exception occurred applying plugin request [id: 'org.jetbrains.kotlin.android', version: '1.9.24']
> Failed to apply plugin 'org.jetbrains.kotlin.android'.
> lateinit property target has not been initialized

* Try:
> Run with --info or --debug option to get more log output.
> Run with --scan to get full insights.
> Get more help at https://help.gradle.org.

* Exception is:
org.gradle.api.plugins.InvalidPluginException: An exception occurred applying plugin request [id: 'org.jetbrains.kotlin.android', version: '1.9.24']
Caused by: org.gradle.api.internal.plugins.PluginApplicationException: Failed to apply plugin 'org.jetbrains.kotlin.android'.
Caused by: kotlin.UninitializedPropertyAccessException: lateinit property target has not been initialized
at org.jetbrains.kotlin.gradle.dsl.KotlinAndroidProjectExtension.getTarget(KotlinProjectExtension.kt:413)
at org.jetbrains.kotlin.gradle.dsl.KotlinAndroidProjectExtension_Decorated.getTarget(Unknown Source)
at org.jetbrains.kotlin.gradle.dsl.KotlinAndroidProjectExtension.getTarget(KotlinProjectExtension.kt:412)
at com.google.devtools.ksp.gradle.KspConfigurations.decorateKotlinProject(KspConfigurations.kt:93)
at com.google.devtools.ksp.gradle.KspConfigurations.access$decorateKotlinProject(KspConfigurations.kt:14)
at com.google.devtools.ksp.gradle.KspConfigurations$1.invoke(KspConfigurations.kt:87)
at com.google.devtools.ksp.gradle.KspConfigurations$1.invoke(KspConfigurations.kt:85)
at com.google.devtools.ksp.gradle.KspConfigurations._init_$lambda$4(KspConfigurations.kt:85)
Я пытался реализовать Kotlin Parcelize и KSP для базы данных Room. Но когда я добавляю эти две зависимости, появляется эта ошибка.
Это мой lins.versions.toml:

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

[versions]
activityKtx = "1.9.3"
agp = "8.7.0"
coreSplashscreen = "1.0.1"
coreTesting = "2.2.0"
datastorePreferences = "1.1.1"
espressoCoreVersion = "3.6.1"
espressoIdlingResource = "3.6.1"
fragmentKtx = "1.8.4"
kotlin = "1.9.24"
coreKtx = "1.13.1"
junit = "4.13.2"
junitVersion = "1.2.1"
espressoCore = "3.6.1"
appcompat = "1.7.0"
kotlinGradlePlugin = "1.9.24"
kotlinxCoroutinesTest = "1.7.3"
lifecycleRuntimeKtx = "2.8.6"
material = "1.12.0"
activity = "1.9.3"
constraintlayout = "2.1.4"
androidAsyncHttp = "1.4.11"
converterGson = "2.9.0"
glide = "4.16.0"
loggingInterceptor = "4.11.0"
mockitoCore = "4.4.0"
pagingRuntimeKtx = "3.3.2"
retrofit = "2.9.0"
navigationFragmentKtx = "2.8.3"
navigationUiKtx = "2.8.3"
ksp = "1.9.24-1.0.20"
roomKtx = "2.6.1"
roomPaging = "2.6.1"

[libraries]
androidx-activity-ktx = { module = "androidx.activity:activity-ktx", version.ref = "activityKtx" }
androidx-core-ktx = { group = "androidx.core", name = "core-ktx", version.ref = "coreKtx" }
androidx-core-splashscreen = { module = "androidx.core:core-splashscreen", version.ref = "coreSplashscreen" }
androidx-core-testing = { module = "androidx.arch.core:core-testing", version.ref = "coreTesting" }
androidx-datastore-preferences = { module = "androidx.datastore:datastore-preferences", version.ref = "datastorePreferences" }
androidx-espresso-idling-resource = { module = "androidx.test.espresso:espresso-idling-resource", version.ref = "espressoIdlingResource" }
androidx-espresso-intents = { module = "androidx.test.espresso:espresso-intents", version.ref = "espressoCoreVersion" }
androidx-fragment-ktx = { module = "androidx.fragment:fragment-ktx", version.ref = "fragmentKtx" }
androidx-lifecycle-livedata-ktx = { module = "androidx.lifecycle:lifecycle-livedata-ktx", version.ref = "lifecycleRuntimeKtx" }
androidx-lifecycle-runtime-ktx = { module = "androidx.lifecycle:lifecycle-runtime-ktx", version.ref = "lifecycleRuntimeKtx" }
androidx-lifecycle-viewmodel-ktx = { module = "androidx.lifecycle:lifecycle-viewmodel-ktx", version.ref = "lifecycleRuntimeKtx" }
androidx-paging-runtime-ktx = { module = "androidx.paging:paging-runtime-ktx", version.ref = "pagingRuntimeKtx" }
androidx-room-compiler = { module = "androidx.room:room-compiler", version.ref = "roomKtx" }
androidx-room-paging = { module = "androidx.room:room-paging", version.ref = "roomPaging" }
androidx-room-ktx = { module = "androidx.room:room-ktx", version.ref = "roomKtx" }
junit = { group = "junit", name = "junit", version.ref = "junit" }
androidx-junit = { group = "androidx.test.ext", name = "junit", version.ref = "junitVersion" }
androidx-espresso-core = { group = "androidx.test.espresso", name = "espresso-core", version.ref = "espressoCore" }
androidx-appcompat = { group = "androidx.appcompat", name = "appcompat", version.ref = "appcompat" }
kotlin-gradle-plugin = { module = "org.jetbrains.kotlin:kotlin-gradle-plugin", version.ref = "kotlinGradlePlugin" }
kotlinx-coroutines-test = { module = "org.jetbrains.kotlinx:kotlinx-coroutines-test", version.ref = "kotlinxCoroutinesTest" }
material = { group = "com.google.android.material", name = "material", version.ref = "material" }
androidx-activity = { group = "androidx.activity", name = "activity", version.ref = "activity" }
androidx-constraintlayout = { group = "androidx.constraintlayout", name = "constraintlayout", version.ref = "constraintlayout" }
android-async-http = { module = "com.loopj.android:android-async-http", version.ref = "androidAsyncHttp" }
glide = { module = "com.github.bumptech.glide:glide", version.ref = "glide"  }
logging-interceptor = { module = "com.squareup.okhttp3:logging-interceptor", version.ref = "loggingInterceptor" }
mockito-core = { module = "org.mockito:mockito-core", version.ref = "mockitoCore" }
mockito-inline = { module = "org.mockito:mockito-inline", version.ref = "mockitoCore" }
retrofit = { module = "com.squareup.retrofit2:retrofit", version.ref = "retrofit" }
retrofit2-converter-gson = { module = "com.squareup.retrofit2:converter-gson", version.ref = "converterGson" }
androidx-navigation-fragment-ktx = { group = "androidx.navigation", name = "navigation-fragment-ktx", version.ref = "navigationFragmentKtx" }
androidx-navigation-ui-ktx = { group = "androidx.navigation", name = "navigation-ui-ktx", version.ref = "navigationUiKtx" }

[plugins]
android-application = { id = "com.android.application", version.ref = "agp" }
kotlin-android = { id = "org.jetbrains.kotlin.android", version.ref = "kotlin" }
devtools-ksp = { id = "com.google.devtools.ksp", version.ref = "ksp" }
kotlin-parcelize = { id = "org.jetbrains.kotlin.plugin.parcelize", version.ref = "kotlin"  }
Это мой build.gradle (уровень проекта):

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

plugins {
alias(libs.plugins.devtools.ksp) apply false
alias(libs.plugins.kotlin.android) apply false
alias(libs.plugins.kotlin.parcelize) apply false
alias(libs.plugins.android.application) apply false
}
А это мой build.gradle (уровень модуля):

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

plugins {
alias(libs.plugins.devtools.ksp)
alias(libs.plugins.kotlin.android)
alias(libs.plugins.kotlin.parcelize)
alias(libs.plugins.android.application)
}

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

defaultConfig {
applicationId = "com.example.sateapalehgeurogokapp"
minSdk = 24
targetSdk = 34
versionCode = 1
versionName = "1.0"

testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner"

buildConfigField("String", "BASE_URL", "\"https://api-sate-apaleh-geurugok.exatc.com/api/\"")
}

buildFeatures {
viewBinding = true
buildConfig = true
}

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 {
// Based Library
implementation(libs.material)
implementation(libs.androidx.core.ktx)
implementation(libs.androidx.appcompat)
implementation(libs.androidx.activity)

// Retrofit API
implementation(libs.retrofit)
implementation(libs.android.async.http)
implementation(libs.logging.interceptor)
implementation(libs.retrofit2.converter.gson)

// Datastore
implementation(libs.androidx.datastore.preferences)

// Room
implementation (libs.androidx.room.ktx)
ksp(libs.androidx.room.compiler)

// Paging
implementation(libs.androidx.paging.runtime.ktx)
implementation(libs.androidx.room.paging)

//  UI Support
implementation(libs.glide)
implementation(libs.androidx.fragment.ktx)
implementation(libs.androidx.constraintlayout)
implementation(libs.androidx.navigation.ui.ktx)
implementation(libs.androidx.core.splashscreen)
implementation(libs.androidx.navigation.fragment.ktx)

// Coroutine
implementation(libs.androidx.lifecycle.runtime.ktx)
implementation(libs.androidx.lifecycle.viewmodel.ktx)
implementation(libs.androidx.lifecycle.livedata.ktx)
implementation(libs.androidx.activity.ktx)

// UI test
testImplementation(libs.junit)
androidTestImplementation(libs.androidx.junit)
implementation (libs.androidx.espresso.idling.resource)
androidTestImplementation (libs.androidx.espresso.intents)
androidTestImplementation(libs.androidx.espresso.core)

// Unit Testing
testImplementation(libs.mockito.core)
testImplementation(libs.mockito.inline)
testImplementation(libs.androidx.core.testing)
testImplementation(libs.kotlinx.coroutines.test)
}
Я пробовал очистить кеш, сделать кеш недействительным, перестроить проект, добавить путь к классам. Но ничто не может решить мою проблему. Что я должен делать? Пожалуйста, помогите мне, спасибо!

Подробнее здесь: https://stackoverflow.com/questions/791 ... o-apply-pl
Реклама
Ответить Пред. темаСлед. тема

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

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

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

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

  • Похожие темы
    Ответы
    Просмотры
    Последнее сообщение

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