Flutter plugin creation raises Kotlin issue

218 Views Asked by At

Description

When I creat a flutter project, Kotlin works just fine on Visual Studio. But if I set to create a flutter plugin, it happens that on my

Android/src/main/kotlin/example/plugin.kt

right where you're supposed to code you plugin, all Kotlin's code raise Unresolved references and Visual Studio pops the message

Kotlin is not configured.


What have I tried

  1. Check if the Kotlin version installed on my VisulStudio and the one described on my build.gradle matchs
  2. File -> Invalidate Caches / Restart
  3. Reinstall Kotlin
  4. Tools -> Kotlin -> Configure Kotlin
  5. Upgrade my Android Gradle Plugin to 4.1 and Gradle Version to 6.7
group 'com.example.first_plugin'
version '1.0-SNAPSHOT'

buildscript {
    ext.kotlin_version = '1.4.10'
    repositories {
        google()
        jcenter()
    }

    dependencies {
        classpath 'com.android.tools.build:gradle:4.1.0'
        classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
    }
}

rootProject.allprojects {
    repositories {
        google()
        jcenter()
    }
}

apply plugin: 'com.android.library'
apply plugin: 'kotlin-android'
apply plugin: 'kotlin-android-extensions'


android {
    compileSdkVersion 29

    sourceSets {
        main.java.srcDirs += 'src/main/kotlin'
    }
    defaultConfig {
        minSdkVersion 16
    }
    lintOptions {
        disable 'InvalidPackage'
    }
    compileOptions {
        sourceCompatibility "1.8"
        targetCompatibility "1.8"
    }
    buildToolsVersion '30.0.2'
}

dependencies {
    implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
}


  • Android Version: 4.1,
  • Kotlin plugin installed:1.4.10
0

There are 0 best solutions below