Android Studio 3 Kotlin 版本

标签 android android-studio kotlin android-studio-3.0

在启动 Android Studio 3 beta 2 时,我收到以下消息:

"您在 'kotlin-stdlib-1.1.4-2' 库中的 Kotlin 运行时版本是 1.1.4-2,而插件版本是 1.1.4-release-Studio3.0-3。 应更新运行时库以避免兼容性问题。”

buildscript(项目级 gradle)中,我已经将 ext.kotlin_version = '1.1.4-2' 更改为 ext.kotlin_version = '1.1.4 -3'

我尝试重建和清理项目,但没有任何效果,我仍然在启动时收到该消息。

Gradle 项目级别:

buildscript {
ext.kotlin_version = '1.1.4-3'
ext.app_compat_version = '26.0.1'
ext.google_play_services = '11.2.0'
ext.firebase_ui_version = '2.1.1'
ext.retrofit_version = '2.3.0'

repositories {
    google()
    jcenter()
}
dependencies {
    classpath 'com.android.tools.build:gradle:3.0.0-beta3'
    // update kotlin to 1.1.4-2
    classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"

    // NOTE: Do not place your application dependencies here; they belong
    // in the individual module build.gradle files
    classpath 'com.google.gms:google-services:3.1.0'
    classpath ('com.google.firebase:firebase-plugins:1.1.0'){
        exclude group: 'com.google.guava', module: 'guava-jdk5'
    }
}
}

allprojects {
    repositories {
        google()
        jcenter()
    }
}

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

Gradle 应用级别:

apply plugin: 'com.android.application'

apply plugin: 'kotlin-android'

apply plugin: 'kotlin-android-extensions'

android {
    compileSdkVersion 26
    buildToolsVersion "26.0.1"
    defaultConfig {
        applicationId ""
        minSdkVersion 16
        targetSdkVersion 26
        versionCode 1
        versionName "0.0.1 - Alpha"
        testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
    }
    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
    }
}

dependencies {
    implementation fileTree(include: ['*.jar'], dir: 'libs')
    implementation "org.jetbrains.kotlin:kotlin-stdlib-jre7:$kotlin_version"
    implementation 'com.android.support.constraint:constraint-layout:1.0.2'
    testImplementation 'junit:junit:4.12'
    androidTestImplementation 'com.android.support.test:runner:1.0.1'
    androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.1'
    //SUPPORT
    implementation "com.android.support:appcompat-v7:$app_compat_version"
    implementation "com.android.support:design:$app_compat_version"
    implementation "com.android.support:cardview-v7:$app_compat_version"
    //GOOGLE PLAY SERVICES
    compile "com.google.android.gms:play-services-auth:$google_play_services"
    //FIREBASE
    implementation "com.google.firebase:firebase-auth:$google_play_services"
    implementation "com.google.firebase:firebase-database:$google_play_services"
    //FIREBASE UI
    compile "com.firebaseui:firebase-ui-auth:$firebase_ui_version"
    //TRANSITIVE LIBS
    compile "com.android.support:preference-v7:$app_compat_version"
    compile "com.android.support:customtabs:$app_compat_version"
}
apply plugin: 'com.google.gms.google-services'

最佳答案

好的,因为我删除了测试依赖:

testImplementation 'junit:junit:4.12'
androidTestImplementation 'com.android.support.test:runner:1.0.1'
androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.1'

问题已经解决了,但我不知道为什么所以不要问我。

关于Android Studio 3 Kotlin 版本,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/45981973/

相关文章:

java - 如何将2个不同的项目放入一个APK中

android Recyclerview Layoutmanager 的 onLayoutChildren item 内容改变时调用

java - 改变一个数组中的值会改变另一个数组中的值

android-studio - Android Studio 在创建新的 Flutter 项目时卡住了

java - 如何使 TextView 不可见

android - 如何在 Kotlin 中制作双向转换器? (在java中工作)

android - Admob libgdx 插页式广告

android - 安装错误 : INSTALL_PARSE_FAILED_MANIFEST_MALFORMED? 安装失败

android - 将 MainActivity 转换为 Kotlin 后后续构建中的 ClassNotFoundException

c - 互操作 C 库时为 "Unresolved Reference"