【问题标题】:android studio plugin with id: 'kotlin-android-extensions'id 为 'kotlin-android-extensions' 的 android studio 插件
【发布时间】:2017-08-11 20:56:41
【问题描述】:

我正在使用 gradle,我正在尝试将 kotlin 添加到我的项目中。但是当我尝试为 gradle 添加 'kotlin-android-extensions' 插件时,却找不到它。

【问题讨论】:

    标签: android android-studio android-gradle-plugin kotlin kotlin-extension


    【解决方案1】:

    要使用该插件,您必须将其添加到您的根级文件中:

    buildscript {
        repositories {
            jcenter()
            maven {
                url 'https://maven.google.com'
            }
        }
        ext.kotlin_version = '1.1.2-4'
        dependencies {
            classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
        }
    }
    

    【讨论】:

    • @ZiadSaad 是个问题吗?如果它不起作用,请发布您的 build.gradle 和错误的详细信息。
    【解决方案2】:

    尝试将以下内容添加到您的 gradle.build 文件中

    apply plugin: 'kotlin-android'
    apply plugin: 'kotlin-android-extensions'
    

    之后,您必须像这样在依赖项类路径中进行一些更改。

    buildscript {
    ext.kotlin_version = '1.1.60'
    repositories {
        jcenter()
    }
    dependencies {
        classpath 'com.android.tools.build:gradle:2.1.0'
        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
      }
    }
    

    并在依赖项编译中确保添加 jre7 这样。

    compile "org.jetbrains.kotlin:kotlin-stdlib-jre7:$kotlin_version"
    

    在完成所有重建 gradle 之后,你就完成了。这对我有用,因为我现在面临同样的问题,在这之后一切都完成了。希望它也对你有用....

    【讨论】:

      【解决方案3】:

      类路径“org.jetbrains.kotlin:kotlin-gradle-plugin:+” 试试这个

      【讨论】:

      • 请尝试添加关于您的方法如何解决查询的说明。
      猜你喜欢
      • 1970-01-01
      • 2017-12-16
      • 2021-03-18
      • 1970-01-01
      • 1970-01-01
      • 2018-02-07
      • 1970-01-01
      • 2021-07-27
      • 1970-01-01
      相关资源
      最近更新 更多