首页 > 解决方案 > 将 Android Studio 从 2.3.3 更新到 3.2。错误

问题描述

我最近将我的 Android Studio 从 2.3.3 更新到 3.2,但不幸的是已经两天了,我正在尝试修复错误,但我解决的最多,但我的项目中仍然存在一些问题:

  1. gradle build 不断向我显示有关 Kotlin 版本的错误:

    Android Gradle 插件仅支持 Kotlin Gradle 插件版本 1.2.51 及更高版本。项目“XXX”正在使用版本 1.1.4-3。

    => 问题是我的 kotlin 被声明为自动更新版本:

     classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
     implementation "org.jetbrains.kotlin:kotlin-stdlib-jre7:$kotlin_version"
    

    我不知道在哪里可以更改他们提到的版本。

  2. 此行代码始终带有红色下划线:

    implementation 'com.android.support:appcompat-v7:28.0.0'

    构建工具版本为 28.0.2

    声明的错误是:

    所有 com.android.support 库必须使用完全相同的版本规范。

PS:我用的 28.0.0 都是 com.android.support 库。

如果您对这两个问题有任何解决方案,请告诉我。

先感谢您。

这是我的构建文件

apply plugin: 'com.android.application'

apply plugin: 'kotlin-android'

apply plugin: 'com.google.firebase.firebase-crash'

apply plugin: 'io.fabric'

android {
compileSdkVersion 28
buildToolsVersion '28.0.2'
defaultConfig {
    applicationId "com.ameerhamza6733.directmessagesaveandrepost"
    minSdkVersion 17
    targetSdkVersion 28
    versionCode 32
    versionName "1.0.32"
    testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
    vectorDrawables.useSupportLibrary = true
}
buildTypes {
    release {
        minifyEnabled true
        proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
    }
}
}

dependencies {
implementation fileTree(include: ['*.jar'], dir: 'libs')
androidTestImplementation('com.android.support.test.espresso:espresso-core:2.2.2', {
    exclude group: 'com.android.support', module: 'support-annotations'
})
implementation "org.jetbrains.kotlin:kotlin-stdlib-jre7:$kotlin_version"

implementation project(':easy_sharedpreference_library')
implementation 'com.android.support:appcompat-v7:28.0.0'
implementation 'com.android.support.constraint:constraint-layout:1.0.2'
implementation 'org.jsoup:jsoup:1.10.3'
implementation 'com.android.support:cardview-v7:28.0.0'
implementation 'com.squareup.picasso:picasso:2.5.2'
implementation 'com.github.lolucosmin:PermissionsWrapper:version_1.2'
implementation 'com.artjimlop:altex-image-downloader:0.0.4'
implementation 'com.daimajia.numberprogressbar:library:1.4@aar'
implementation 'com.android.support:design:28.0.0'

implementation 'com.google.firebase:firebase-ads:15.0.1'

implementation 'com.webianks.library:easy-feedback:1.0.2'
implementation 'com.github.clans:fab:1.6.4'
implementation 'com.android.volley:volley:1.1.0'
implementation 'com.google.android.ads.consent:consent-library:1.0.6'
implementation 'com.crashlytics.sdk.android:crashlytics:2.9.4'
testImplementation 'junit:junit:4.12'
implementation project(':library')

}
apply plugin: 'com.google.gms.google-services'
repositories {
    mavenCentral()
    google()

}

标签: androidandroid-studiokotlin

解决方案


gradle build 不断向我显示有关 Kotlin 版本的错误:

回答

  1. 打开你的项目级build.gradle 文件,

  2. 在那里你会找到一个名为buildscript.

  3. 转到该块并查找是否有一个名为的变量ext.kotlin_version

  4. 将其更改为最新版本的Kotlin插件。


所有 com.android.support 库必须使用完全相同的版本规范。

问题在于您使用的库easy-feedback的支持库(v25)版本与您使用的(v28) 不同

解决方案是从该依赖项中排除您的支持库,如下所示:

implementation ('com.webianks.library:easy-feedback:1.0.2', {
    exclude group: 'com.android.support'
})

注意:如果问题仍然存在,请检查其他 3rd 方依赖项。


推荐阅读