0

I have already advance in my project, but I want to write android-specific code. It is generated in Kotlin by flutter, but I want Java. How can I change this?

Mark Rotteveel
  • 82,132
  • 136
  • 114
  • 158
Saitmouk
  • 21
  • 1
  • `flutter create --org com.yourpackage -i swift -a kotlin --description 'app name description' your_app_name` – Blasanka Feb 07 '20 at 00:14
  • Maybe create a kotlin project and run it through a kotlin -> java converter – byxor Feb 07 '20 at 00:24
  • Please check this https://stackoverflow.com/questions/34957430/how-to-convert-a-kotlin-source-file-to-a-java-source-file – chunhunghan Feb 07 '20 at 00:47
  • @Blasanka How does linking to a question about Swift, answer a question about Java? – Mark Rotteveel Feb 08 '20 at 09:50
  • @MarkRotteveel sorry I didnt get you – Blasanka Feb 08 '20 at 10:05
  • @Blasanka The OP is asking about generating Java from Flutter, and you link to a question to generate Swift from Flutter. How does that help? – Mark Rotteveel Feb 08 '20 at 10:06
  • @MarkRotteveel oh ok I got you. Title is different but scroll to second answer. Then you will see the solution for both android and swift – Blasanka Feb 08 '20 at 10:06
  • @MarkRotteveel Even the question is pointing out Android. – Blasanka Feb 08 '20 at 10:08
  • @Blasanka Kotlin is a language for Android, just like Java... And the op doesn't want Kotlin, they want Java. – Mark Rotteveel Feb 08 '20 at 10:34
  • Yes @MarkRotteveel I know that, It doesnt matter the environment or the language, in Fluttter framework, this is the command for both: `create --org com.yourpackage -i swift -a kotlin --description 'app name description' your_app_name` I flag it added a comment mentioning this also. – Blasanka Feb 08 '20 at 10:43
  • @Blasanka And that creates a Kotlin application, not a Java application that the OP was asking about. – Mark Rotteveel Feb 08 '20 at 10:45
  • @MarkRotteveel Common I thinking globaly, cant he just change the language there `kotlin` to `java`??? – Blasanka Feb 08 '20 at 10:46

2 Answers2

2

I finally recreated my project with the following command :

flutter create -i swift -a java app_name
Saitmouk
  • 21
  • 1
0

You can run the command flutter create . -i swift -a java in your project directory to convert your current app to swift and java. Make sure to back up your app first. It will also repair your project, recreating any files that are missing.

If this doesn't work, you might have to create a new project with the command flutter create -i objc -a java your_app_name_here, as mentionned above.

olibsjr
  • 81
  • 3