3

Created a new Flutter project with Kotlin support on Android Studio and it is giving the following error on running the app:-

  • What went wrong: Execution failed for task ':app:compileDebugKotlin'.

Now I just want to remove the Kotlin support from my project, please suggest the steps?

Gagandeep Gambhir
  • 4,225
  • 1
  • 29
  • 34

1 Answers1

2

According to your question, there might be many reasons behind...
Check out this Stack Overflow Solution if this can work.
Apart from this, To remove Kotlin support you can check your Gradle for some lines below..

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

    dependencies {
        ...
        classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
    }
}
...
apply plugin: 'kotlin-android'
...
android{
    ...
    sourceSets {
        main.java.srcDirs += 'src/main/kotlin'
    }
    ...
}
dependencies {
    implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
    ...
}

Delete all of these above to remove kotlin support in your project.

Sanket Vekariya
  • 2,848
  • 3
  • 12
  • 34
  • Also, comment out any kotlin keyworded options: `// kotlinOptions { jvmTarget = '1.8' }` and remember to add a `MainActivity.java` under main/java/ folder (with or without namespace dir structure) and delete kt folder: ` package com.msheriff.kingdom; import io.flutter.embedding.android.FlutterActivity; public class MainActivity extends FlutterActivity { } ` – Mohammed Sheriff Jul 16 '22 at 22:43