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 '
AGPBI: {“kind”:“error”,“text”:“Can’t determine type for tag ‘
降级 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 的兼容性对应关系
build.gradle.kts
注释package。
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")
}
来源地址:https://blog.csdn.net/qq_42015021/article/details/133714547