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

前端 未结 3 1612
借酒劲吻你
借酒劲吻你 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:37

    In Android Studio we can fix it in following ways:_

    Using the plugins Domain Specific Language (DSL) in App Level Graddle:

    plugins {
        id "org.jetbrains.kotlin.android.extensions" version "1.4.21"
    }
    

    That's all to fix it.

    But if you're using legacy plugin application, then add the following in App Level Gradle:

    buildscript {
      repositories {
        maven {
          url "https://plugins.gradle.org/m2/"
        }
      }
      dependencies {
        classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:1.4.21"
      }
    }
    
    apply plugin: "org.jetbrains.kotlin.android.extensions"
    

    Hopefully, it'll be helpful!

    0 讨论(0)
  • 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.

    0 讨论(0)
  • 2021-01-07 16:51

    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"
        }
    }
    
    0 讨论(0)
提交回复
热议问题