android-studio - 错误 :(1, 0) 未找到 ID 为 'kotlin-android-extensions' 的插件

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

apply plugin: 'kotlin-android-extensions'.

当我在 android studio 预览中添加这个扩展时,给我这个错误
“错误:(1, 0) 未找到 ID 为 'kotlin-android-extensions' 的插件。”。

我的构建等级
   apply plugin: 'com.android.application'

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

dependencies {
    implementation fileTree(dir: 'libs', include: ['*.jar'])
    implementation 'com.android.support:appcompat-v7:26.0.2'
    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'
}

最佳答案

To use the plugin, you have to add it in your root build.gradle file


buildscript {
ext.kotlin_version = '1.1.60'
    repositories {
        jcenter()
        maven {
            url 'https://maven.google.com'
        }
    }

    dependencies {
        classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
    }
}

关于android-studio - 错误 :(1, 0) 未找到 ID 为 'kotlin-android-extensions' 的插件,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/46101908/

相关文章:

android - 在哪里可以找到 liveData 构建 block ?

kotlin - 是否可以在 "by lazy"初始化程序中暂停协程?我收到 "runBlocking is not allowed in Android main looper thread"的错误

android - 在哪里下载 Eclipse?

android - 磁盘上不存在 .apk 文件,但确实存在

java - 安卓工作室;底部导航 View = 空

android - 使用文本字段会使应用崩溃

java - 如何将数据从 SQlite 导出到 CSV 或 Excel 或其他格式?

android - CMake 的构建命令失败

Android Studio——导致 : error=86, 可执行文件中的错误 CPU 类型

Android Studio,构建 kotlin : wrong code generated 时出现奇怪错误