Search code examples
javaandroidkotlinandroid-activityflutter

Flutter not creating Java Classes only Kotlin Instead


I am creating a simple flutter project with latest stable version of flutter. The project, I am creating is without any kotlin support because I want to use java but it is still creating only Kotlin MainActivity class by default. is there a way to use java?


Solution

  • If you are creating a new flutter app using the latest stable version, the default now is Kotlin for android and Swift for IOS. You can read more here: https://github.com/flutter/flutter/issues/21190

    If you want to create a new app using Java for Android and Objective-C for IOS use the following command:

    flutter create -i objc -a java new_app
    

    And if you have an existing app

    flutter create -i objc -a java .