错误:(1,0)找不到ID为'kotlin-android-extensions'的插件 [英] Error:(1, 0) Plugin with id 'kotlin-android-extensions' not found

查看:1274
本文介绍了错误:(1,0)找不到ID为'kotlin-android-extensions'的插件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

apply plugin: 'kotlin-android-extensions'.

当我在android studio预览中添加此扩展程序时,给我这个错误 错误:(1、0)找不到ID为'kotlin-android-extensions'的插件."

When i add this extensions in android studio preview, give me this error "Error:(1, 0) Plugin with id 'kotlin-android-extensions' not found.".

我的构建gradle

My build gradle

   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'
}

推荐答案

您发布的build.gradle片段类似于应用程序模块中的配置.项目根目录中的build.gradle是什么样的?要添加kotlin插件依赖项,它应如下所示:

The build.gradle snippet you posted looks like the config inside your app module. What does the build.gradle in your project's root directory look like? To add the kotlin plugin dependencies it should look something like this:

buildscript {
    ext.kotlin_version = '1.1.50'
    repositories {
        jcenter()
        google()

    }
    dependencies {
        classpath 'com.android.tools.build:gradle:3.0.0-beta6'
        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
    }
}

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

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

重要的部分是classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"行,其中添加了kotlin插件.

The important part being the line classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"which adds the kotlin plugins.

这篇关于错误:(1,0)找不到ID为'kotlin-android-extensions'的插件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆