gpt4 book ai didi

android - Unresolved reference : android build failed with kotlin dsl (reproducible in an empty project)

转载 作者:行者123 更新时间:2023-12-05 06:54:31 37 4
gpt4 key购买 nike

我的build.gradle.kts(:app):

plugins {


id("com.android.application")
kotlin("plugin.serialization") version "1.4.21-release-Studio4.2-1"
kotlin("android")
kotlin("android.extensions")
kotlin("kapt")
}

android {
compileSdkVersion (30)
buildToolsVersion ("30.0.2")
defaultConfig {
applicationId ="learnprogramming.academy.relaf"
minSdkVersion(24)
targetSdkVersion(30)
versionCode =1
versionName ="1.0"
testInstrumentationRunner ="androidx.test.runner.AndroidJUnitRunner"
javaCompileOptions {
annotationProcessorOptions {
arguments["room.incremental"] = "true"
}
}
}
buildTypes {
getByName("release") {
isMinifyEnabled = true
proguardFiles(getDefaultProguardFile("proguard-android.txt"), "proguard-rules.pro")
}
}
buildFeatures {
// Enables Jetpack Compose for this module
compose = true
}
compileOptions {
sourceCompatibility= JavaVersion.VERSION_1_8
targetCompatibility= JavaVersion.VERSION_1_8
}

kotlinOptions {
jvmTarget = "1.8"
useIR = true
}
composeOptions {
kotlinCompilerVersion= "1.4.21-release-Studio4.2-1"
kotlinCompilerExtensionVersion= "1.0.0-alpha08"
}
}
dependencies {

val composeVersion = "1.0.0-alpha08"
// implementation ("androidx.compose.runtime:runtime:$composeVersion")
// implementation ("androidx.compose.compiler:compiler:$composeVersion")
// implementation ("androidx.compose.ui:ui:$composeVersion")
// Tooling support (Previews, etc.)
implementation ("androidx.compose.ui:ui-tooling:$composeVersion")
// Foundation (Border, Background, Box, Image, Scroll, shapes, animations, etc.)
implementation ("androidx.compose.foundation:foundation:$composeVersion")
// Material Design
implementation ("androidx.compose.material:material:$composeVersion")
// Material design icons
implementation ("androidx.compose.material:material-icons-core:$composeVersion")
implementation ("androidx.compose.material:material-icons-extended:$composeVersion")
// Integration with observables
implementation ("androidx.compose.runtime:runtime-livedata:$composeVersion")

val roomVersion = "2.3.0-alpha04"

implementation( "androidx.room:room-runtime:$roomVersion")
kapt ("androidx.room:room-compiler:$roomVersion")
val kotlin_version = "1.4.21"
implementation ("org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version")
implementation( "androidx.appcompat:appcompat:1.3.0-alpha02")
testImplementation ("junit:junit:4.12")
implementation(fileTree(mapOf("dir" to "libs", "include" to listOf("*.jar"))))
// optional - Kotlin Extensions and Coroutines support for Room
implementation ("androidx.room:room-ktx:$roomVersion")
// ViewModel and LiveData
val lifecycle_version = "2.2.0"
implementation ("androidx.lifecycle:lifecycle-viewmodel-ktx:$lifecycle_version")
implementation ("androidx.lifecycle:lifecycle-extensions:$lifecycle_version")
implementation ("androidx.fragment:fragment-ktx:1.2.2")
// RecyclerView
implementation ("androidx.recyclerview:recyclerview:1.0.0")
implementation ("com.google.android.material:material:1.3.0-alpha03")
implementation ("org.jetbrains.kotlinx:kotlinx-coroutines-android:1.3.9")
implementation ("com.android.volley:volley:1.1.1")
implementation("org.jsoup:jsoup:1.13.1")
implementation("org.jetbrains.kotlinx:kotlinx-serialization-json:1.0.1")
implementation ("androidx.core:core-ktx:1.0.2")
implementation ("androidx.constraintlayout:constraintlayout:1.1.3")
androidTestImplementation ("androidx.test.ext:junit:1.1.0")
androidTestImplementation( "androidx.test.espresso:espresso-core:3.1.1")
}

我的另一个 build.gradle.kts(前 10 个下载器):

buildscript {
val kotlin_version = "1.4.21"
repositories {
google()
jcenter()
}
dependencies {
classpath ("com.android.tools.build:gradle:7.0.0-alpha03")
classpath ("org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version")
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}

allprojects {
repositories {
google()
jcenter()
}
}

tasks.register("clean",Delete::class){
delete(rootProject.buildDir)
}

我的settings.gradle.kts:

include (":app")
rootProject.name="Top 10 Downloader"

它可以在一个空项目中重现。我正在使用最新的 canary android studio arctic fox。我做错了什么?

最佳答案

确定发现错误。最新的 canary android studio 更新了我的 gradle 版本,并且由于 gradle 更新,build.gradle 中的 buildFeatures { compose = true } 导致 gradle 永远运行,因为我使用的是现在已弃用的 kotlin 合成。所以在最新的 gradle (7) 中,使用合成(不仅仅是添加)和 IMPORTINGbuildFeatures { compose = true } 导致 gradle 无限循环。

关于android - Unresolved reference : android build failed with kotlin dsl (reproducible in an empty project),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/65519299/

37 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com