Cannot use @TaskAction annotation on method IncrementalTask.taskAction$gradle_core() because interface org.gradle.api.tasks.incremental.IncrementalTaskInputs is not a valid parameter to an action method.
修改下面两处地方分别为7.0.3、7.3.3
Android Gradle plugin requires Java 11 to run. You are currently using Java 1.8.
An exception occurred applying plugin request [id: 'com.android.application']
> Failed to apply plugin 'com.android.internal.application'.
> Android Gradle plugin requires Java 11 to run. You are currently using Java 1.8.
You can try some of the following options:
- changing the IDE settings.
- changing the JAVA_HOME environment variable.
- changing `org.gradle.java.home` in `gradle.properties`.
Can’t determine type for tag '<macro name=“m3_comp_switch_disabled_selected_handle_color”>
AGPBI: {“kind”:“error”,“text”:“Can’t determine type for tag ‘<macro name=“m3_comp_switch_disabled_selected_handle_color”>?attr/colorSurface’”,“sources”:[{“file”:“/Users/fausto/.gradle/caches/transforms-3/4948d05d0ff6027d2e3c9f4a6010103b/transformed/material-1.7.0-alpha02/res/values/values.xml”}],“tool”:“Resource and asset merger”}
降级 androidx.appcompat:appcompat
降级 com.google.android.material:material
为以下版本
implementation 'androidx.appcompat:appcompat:1.4.1'
implementation 'com.google.android.material:material:1.6.0'
Unexpected tokens (use ‘;’
e: D:\work\HappyBirthday\settings.gradle.kts:3:21: Unexpected tokens (use ';' to separate expressions on the same line)
国内镜像如此配置
pluginManagement {
repositories {
maven { url = uri('https://maven.aliyun.com/repository/google') };
maven { url = uri('https://maven.aliyun.com/repository/jcenter') };
maven { url = uri('https://maven.aliyun.com/repository/gradle-plugin') }
}
}
dependencyResolutionManagement {
repositoriesMode.set(RepositoriesMode.FAIL_ON_PROJECT_REPOS)
repositories {
maven { url = uri('https://maven.aliyun.com/repository/google') };
maven { url = uri('https://maven.aliyun.com/repository/jcenter') };
maven { url = uri('https://maven.aliyun.com/repository/gradle-plugin') }
}
}
org.jetbrains.kotlin.android 版本
plugins {
id("com.android.application") version "7.0.3" apply false
id("org.jetbrains.kotlin.android") version "1.5.31" apply false
}
Compose 与 Kotlin 的兼容性对应关系
文章来源:https://www.toymoban.com/news/detail-765510.html
build.gradle.kts
注释package。文章来源地址https://www.toymoban.com/news/detail-765510.html
plugins {
id("com.android.application")
id("org.jetbrains.kotlin.android")
}
android {
namespace = "cn.jj.happybirthday"
compileSdk = 33
defaultConfig {
applicationId = "cn.jj.happybirthday"
minSdk = 24
targetSdk = 33
versionCode = 1
versionName = "1.0"
testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner"
vectorDrawables {
useSupportLibrary = true
}
}
buildTypes {
release {
isMinifyEnabled = 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"
}
// packaging {
// 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(platform("androidx.compose:compose-bom:2023.03.00"))
implementation("androidx.compose.ui:ui")
implementation("androidx.compose.ui:ui-graphics")
implementation("androidx.compose.ui:ui-tooling-preview")
implementation("androidx.compose.material3:material3")
testImplementation("junit:junit:4.13.2")
androidTestImplementation("androidx.test.ext:junit:1.1.5")
androidTestImplementation("androidx.test.espresso:espresso-core:3.5.1")
androidTestImplementation(platform("androidx.compose:compose-bom:2023.03.00"))
androidTestImplementation("androidx.compose.ui:ui-test-junit4")
debugImplementation("androidx.compose.ui:ui-tooling")
debugImplementation("androidx.compose.ui:ui-test-manifest")
}
到了这里,关于Android Studio版本升级后的问题 gradle降级、jdk升级 Compose 与 Kotlin 的兼容性对应关系的文章就介绍完了。如果您还想了解更多内容,请在右上角搜索TOY模板网以前的文章或继续浏览下面的相关文章,希望大家以后多多支持TOY模板网!