Error:Kotlin: Unsupported plugin option: org.jetbrains.kotlin.android:enabled=true

旧城冷巷雨未停 提交于 2019-12-03 06:48:09

问题


Today I receive this error, while exactly same code was working an hour ago

Error:Kotlin: Unsupported plugin option: org.jetbrains.kotlin.android:enabled=true

and this, and project doesn't run:

Cause: duplicate entry:...

Update : Deleting .AndroidStudio folder from User folder resolved problem, at least for now!

this is my build.gradle :

configurations.all {
    resolutionStrategy {
        force "com.android.support:appcompat-v7:$project.andySDK"
        force "com.android.support:support-vector-drawable:$project.andySDK"
        force "com.android.support:support-v4:$project.andySDK"
        force "com.android.support:animated-vector-drawable:$project.andySDK"
        force "com.android.support:design:$project.andySDK"
        force "com.android.support:recyclerview-v7:$project.andySDK"
        force "com.android.support:cardview-v7:$project.andySDK"

        force "net.sf.proguard:proguard-gradle:5.2.1"
    }
}

buildscript {
    repositories {
        maven { url 'https://maven.fabric.io/public' }
    }

    dependencies {
        classpath 'io.fabric.tools:gradle:1.+'
    }
}
apply plugin: 'com.android.application'
apply plugin: 'io.fabric'


repositories {
    maven { url 'https://maven.fabric.io/public' }
    maven { url 'https://jitpack.io' }
    mavenCentral()
}

apply plugin: 'checkstyle'

android {
    dexOptions {
        preDexLibraries = true
        javaMaxHeapSize "8G"
    }
    compileSdkVersion Integer.parseInt(project.ANDROID_COMPILE_SDK_VERSION)
//    buildToolsVersion project.ANDROID_BUILD_TOOLS_VERSION
    defaultConfig {
        applicationId "com.office.zero"
        multiDexEnabled true
        versionCode 62
        versionName "v2.0 (1397_01_18)"

        setProperty("archivesBaseName", applicationId + "-v" + versionCode + "(" + versionName + ")")

        minSdkVersion Integer.parseInt(project.ANDROID_MIN_SDK)
        targetSdkVersion Integer.parseInt(project.ANDROID_TARGET_SDK_VERSION)
        vectorDrawables.useSupportLibrary = true
    }
    sourceSets {
        main {
            manifest.srcFile 'AndroidManifest.xml'
            java.srcDirs = ['src/main/java']
            res.srcDirs = ['res']
        }
        test {
            java.srcDirs = ['src/test/java']
        }
    }
    compileOptions {
        sourceCompatibility JavaVersion.VERSION_1_7
        targetCompatibility JavaVersion.VERSION_1_7
    }
    packagingOptions {
        exclude 'META-INF/ASL2.0'
        exclude 'META-INF/DEPENDENCIES.txt'
        exclude 'META-INF/LICENSE.txt'
        exclude 'META-INF/NOTICE.txt'
        exclude 'META-INF/NOTICE'
        exclude 'META-INF/LICENSE'
        exclude 'META-INF/DEPENDENCIES'
        exclude 'META-INF/notice.txt'
        exclude 'META-INF/license.txt'
        exclude 'META-INF/dependencies.txt'
        exclude 'META-INF/LGPL2.1'
        exclude 'META-INF/services/javax.annotation.processing.Processor'
        exclude 'META-INF/spring.tooling'
        exclude 'META-INF/spring.handlers'
        exclude 'META-INF/spring.schemas'
    }
    lintOptions {
        abortOnError false
    }
    buildTypes {
        release {
//            minifyEnabled true
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
        debug {
            multiDexEnabled false
        }
    }

}

dependencies {
    implementation "com.android.support:support-v4:$project.andySDK"
    implementation "com.android.support:support-vector-drawable:$project.andySDK"
    implementation "com.android.support:appcompat-v7:$project.andySDK"
    implementation "com.android.support:recyclerview-v7:$project.andySDK"
    implementation "com.android.support:cardview-v7:$project.andySDK"
    implementation "com.android.support:design:$project.andySDK"
    implementation 'com.android.support.constraint:constraint-layout:1.0.2'
    implementation project(':folioreader')
    implementation "com.google.android.gms:play-services-auth:$project.googlePlayServiceVersion"
    implementation 'pub.devrel:easypermissions:0.3.0'
    implementation('com.google.api-client:google-api-client-android:1.23.0') {
        exclude group: 'org.apache.httpcomponents'
    }
    //    compile 'cn.pedant.sweetalert:library:1.3'
    implementation 'com.squareup.retrofit2:retrofit:2.3.0'
    implementation 'com.squareup.retrofit2:converter-scalars:2.1.0'
    implementation 'com.afollestad.material-dialogs:core:0.9.6.0'
    implementation "com.google.firebase:firebase-core:$project.googlePlayServiceVersion"
    implementation "com.google.firebase:firebase-messaging:$project.googlePlayServiceVersion"
    implementation 'com.firebase:firebase-jobdispatcher:0.8.5'
    implementation 'com.squareup:otto:1.3.8'
    implementation 'uk.co.chrisjenx:calligraphy:2.3.0'
    implementation('com.crashlytics.sdk.android:crashlytics:2.9.1@aar') {
        transitive = true
    }
    implementation 'com.kaopiz:kprogresshud:1.1.0'
    implementation 'com.github.bmelnychuk:atv:1.2.+'
    implementation 'in.srain.cube:ultra-ptr:1.0.11'
    implementation 'com.android.support:multidex:1.0.3'
    implementation project(':wp-api-v2-client-android')
    implementation 'io.jsonwebtoken:jjwt:0.9.0'
    implementation 'com.mani:ThinDownloadManager:1.4.0'
    implementation "android.arch.lifecycle:runtime:$project.archLifecycleVersion"
    implementation "android.arch.lifecycle:extensions:$project.archLifecycleVersion"
    annotationProcessor "android.arch.lifecycle:compiler:$project.archLifecycleVersion"
    implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"

    implementation 'com.google.code.gson:gson:2.8.0'
    //    compile "org.jetbrains.kotlinx:kotlinx-coroutines-core:0.22.3"
}

apply plugin: 'com.google.gms.google-services'

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

回答1:


File -> Settings -> Plugins.

Then unselect red items, restart Android Studio, select "Android Support" and restart. This maybe work.




回答2:


Taking pointers from this answer - https://stackoverflow.com/a/49972566/7599300, I got rid by doing following steps:

File -> Settings -> Plugins

Unselect and select again red marked plugins.

Click Apply and then OK.

Android Studio will prompt to Restart, just Restart it.




回答3:


Android > Preferences... > Plugins

Check Kotlin version:

Then on the top-level build.gradle make sure that the version matches:

buildscript {
    ext.kotlin_version = '1.2.71'
    // ...
}



回答4:


I solved this issue in a working project.

Error:Kotlin: Unsupported plugin option: org.jetbrains.kotlin.android:enabled=true

doing the following:

  • Updating the kotlin plugin.
  • File > Invalidate cache/ restart > Invalidate and restart.



回答5:


Recently I also faced same issue,

Error:Kotlin: Unsupported plugin option: org.jetbrains.kotlin.android:enabled=true

I solved this issue by simply updating the kotlin plugin and now it is working fine.




回答6:


FYI: I removed the Kotlin directory from ~/Library/Application Support/AndroidStudio3.1, cleaned and built and everything worked fine. After putting the Kotlin directory back, cleaning and rebuilding, the same error resurfaced.




回答7:


I also encountered this problem. My Kotlin plugin was already up to date, so I knew that this wasn't going to be the problem. I ended up fixing it by following these steps:

  • Android Studio > Preferences > Appearance & Behavior > System Settings > Android SDK
  • Click the "Edit" button next to the Android SDK location path

  • Follow the wizard.

Android Studio will now download missing or outdated SDK components.

After following the steps above I could successfully build my project again. I still have no idea why this problem suddenly arose though.




回答8:


If you find this error when try to start findbugs.

Do as : Settings - FindBugs-IDEA - General : Uncheck the “Compile affected files before analyze” and “Analyze affected files after compile”



来源:https://stackoverflow.com/questions/49789802/errorkotlin-unsupported-plugin-option-org-jetbrains-kotlin-androidenabled-tr

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!