gpt4 book ai didi

更新到版本 4.10 后 Android Gradle 同步失败

转载 作者:行者123 更新时间:2023-11-30 05:04:45 26 4
gpt4 key购买 nike

将 AndroidStudio、Gradle 和 com.android.tools.build:gradle 更新到新版本后,出现此错误:

org/jetbrains/kotlin/kapt/idea/KaptGradleModelorg/jetbrains/kotlin/kapt/idea/KaptGradleModel

gradle.properties:

#Mon Feb 18 21:35:48 IRST 2019
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-4.10.1-all.zip

项目 Gradle:

buildscript {
ext.kotlin_version = '1.3.21'
repositories {
google()
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.3.1'
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
classpath 'com.jakewharton.hugo:hugo-plugin:1.2.1'
classpath 'com.novoda:bintray-release:0.9'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}

allprojects {
repositories {
google()
jcenter()
maven { url "https://jitpack.io" }
}
}


ext {
VERSION = version()
}

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


task version {
println version()
}

def String version() {
def versionPropsFile = file('version.properties')
def Properties versionProps = new Properties()
versionProps.load(new FileInputStream(versionPropsFile))

return versionProps['major'] + "." + versionProps['minor'] + "." + versionProps['patch']
}

然后是 app gradle:

apply plugin: 'com.android.application'
apply plugin: 'kotlin-android'
apply plugin: 'kotlin-android-extensions'
apply plugin: 'com.jakewharton.hugo'
apply plugin: 'com.novoda.bintray-release'

android {
compileSdkVersion 28

defaultConfig {
applicationId "xxx.xxxxxxx.xxxxxxxxxxxx"
minSdkVersion 21
versionCode 1
versionName "1"
vectorDrawables.useSupportLibrary = true
multiDexEnabled = true
}

dataBinding {
enabled = true
}

packagingOptions {
exclude 'META-INF/DEPENDENCIES.txt'
exclude 'META-INF/LICENSE.txt'
exclude 'META-INF/NOTICE.txt'
exclude 'META-INF/NOTICE'
exclude 'META-INF/LICENSE'
exclude 'META-INF/DEPENDENCIES'
exclude 'META-INF/notice.txt'
exclude 'META-INF/license.txt'
exclude 'META-INF/dependencies.txt'
exclude 'META-INF/LGPL2.1'
exclude 'META-INF/rxjava.properties'
}

buildTypes {
release {
minifyEnabled true
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}

最佳答案

升级您的 Kotlin 插件。

简单的方法(推荐)。

Double shift -> 插件 -> 更新 -> 搜索 Kotlin -> 更新! -> 重启 AS

手动方式(如果需要)。

1) 从此链接手动下载 Kotlin 插件。

2) Double shift -> Plugins -> (Settings) Icon -> Install from disk -> 选择那个插件。

3) 重启 Android Studio。

关于更新到版本 4.10 后 Android Gradle 同步失败,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/54753982/

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