gpt4 book ai didi

android - 应用插件请求时发生异常 [id : 'com.android.application' ] while integration Jetpack Compose

转载 作者:行者123 更新时间:2023-12-03 18:36:11 26 4
gpt4 key购买 nike

我正在尝试实现 JetPack 组合 使用 Canary 8 但每次尝试同步 gradle 时都会出现此错误

An exception occurred applying plugin request [id: 'com.android.application']

My app\build.gradle file is below

    plugins {
id 'com.android.application'
id 'kotlin-android'
}

android {
compileSdkVersion 30
buildToolsVersion "30.0.0"

defaultConfig {
applicationId "com.example.myapplication"
minSdkVersion 21
targetSdkVersion 30
versionCode 1
versionName "1.0"

testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
}

buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
}
}
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
kotlinOptions {
jvmTarget = '11'
useIR = true
}
buildFeatures {
compose true
}
composeOptions {
kotlinCompilerExtensionVersion compose_version
kotlinCompilerVersion '1.4.30'
}
}
dependencies {
implementation 'androidx.core:core-ktx:1.3.2'
implementation 'androidx.appcompat:appcompat:1.2.0'
implementation 'com.google.android.material:material:1.2.1'
implementation "androidx.compose.ui:ui:$compose_version"
implementation "androidx.compose.material:material:$compose_version"
implementation "androidx.compose.ui:ui-tooling:$compose_version"
implementation 'androidx.lifecycle:lifecycle-runtime-ktx:2.3.0-alpha06'
implementation 'androidx.activity:activity-compose:1.3.0-alpha02'
testImplementation 'junit:junit:4.+'
androidTestImplementation 'androidx.test.ext:junit:1.1.2'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.3.0'
}

My build.gradle file is below

buildscript {
ext {
compose_version = '1.0.0-beta01'
}
repositories {
google()
mavenCentral()
}
dependencies {
classpath 'com.android.tools.build:gradle:7.0.0-alpha08'
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:1.4.30"
}
}

task clean(type: Delete) {
delete rootProject.buildDir
}

and this is my gradle-wrapper.properties

distributionBase=GRADLE_USER_HOME
distributionUrl=https\://services.gradle.org/distributions/gradle-6.8.2-all.zip
distributionPath=wrapper/dists
zipStorePath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME

最佳答案

Android Gradle 插件 7 需要 Java 11。
转至 File > Project Structure并将 JDK 位置更改为 Embedded JDK .

关于android - 应用插件请求时发生异常 [id : 'com.android.application' ] while integration Jetpack Compose,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/66376361/

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