How to avoid opening kotlin/java files automatically in Flutter

 


Starting wizard from Android Studio's landing page

In one of my "Learn Flutter together" sessions, one participant encountered an annoying issue. Instead of opening main.dart file, Android Studio always opens the MainActivity.java or MainActivity.kt. I didn't know how to solve that issue. Until I got an idea today.

Today I happened to run the wizard from the landing page of Android Studio (AS) (see the picture above), not from inside an opened Flutter project through File, New, New Flutter project.

It seems that starting the wizard from AS landing page, will show the page where various languages/frameworks can be selected (see the picture below).



When starting a new Flutter project, a beginner could have accidentally clicked on Android or Java instead. That creates the issue with the Flutter project. At least this, I believe, was the cause.

Therefore please make sure to select Flutter (see no 1 in the picture above) before continuing to the next page! 

BTW please also make sure the Flutter SDK path points to the folder where flutter is installed. The path is different on Windows, Linux and Mac.



In this last page write the name of the app (no. 1) and make sure the folder you want the project will be created in is correct (no. 2). And when everything is set, click the Finish button. That's it. Happy coding.