Error:(1, 0) Plugin with id 'kotlin-android-extensions' not found

前端 未结 3 1635
借酒劲吻你
借酒劲吻你 2021-01-07 15:55
apply plugin: \'kotlin-android-extensions\'.

When i add this extensions in android studio preview, give me this error \"Error:(1, 0) Plugin with id

3条回答
  •  爱一瞬间的悲伤
    2021-01-07 16:45

    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
    }
    

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

提交回复
热议问题