错误:(1,0)未找到id为'kotlin-android-extensions'的插件
apply plugin: 'kotlin-android-extensions'.
当我在android studio预览中添加这个扩展,给我这个错误“错误:(1,0)没有找到id'kotlin-android-extensions'的插件”。
我的构建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插件依赖项,应该看起来像这样:
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 }
其中最重要的部分就是添加kotlin插件的行classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
。
- 错误:执行任务’:app:clean’失败。 无法删除文件
- Kotlin Android开始新的活动
- 安装kotlin后无法打开Android studio项目
- Android Studio 3.0.1错误:Gradle项目同步失败。 基本function(如编辑,调试)将无法正常工作
- Kotlin和RxJava2 zip运算符 – 以下函数都不能用提供的参数调用
- Android Studio 2.2无法find所有kotlin文件的引用
- 针对Kotlin文件的IntelliJ和Android Studio图标
- 在Android Studio中,如何更改Kotlin命名约定?
- 如何在我的Kotlin类中创建一个匿名接口实现并使用它?