Flutter not found when developing plugin for Android
Solution 1
It worked for me when I did the next steps (assuming that Dart and Flutter plugins are configured in the Android Studio Preferences properly):
- Close all the projects up until you see the "welcome to Android Studio" window with recent projects list and a set of options in the center
- Select "Open existing Android Studio project"
- Select the file
plugin/example/android/build.gradle
Solution 2
You should open the project in android studio from the example/android location.
Solution 3
It turned out to be a known error: https://github.com/flutter/flutter/issues/19830. You can find different solutions and general discussion of the problem there.
Provided solutions did not help in my case. What had worked out is this one (by @incloudss):
For everyone who still struggles with that problem, ignore the official documentation, and do not open android project the way they describe it there.
Instead:
- Open the main flutter project.
- Go to Tools -> Flutter -> Open For Editing In Android Studio(yes, it doesn't >make sense because we are already in AS, but it works).
Solution 4
You need to install the Flutter SDK https://flutter.dev/docs/get-started/install/windows#get-the-flutter-sdk
Then in Android Studio, go to settings>plugins, and install the Flutter and Dart plugins.
Then check whether you have provided you SDK path at Settings> Language & Frameworks > Flutter
Leonardo da Silva
Developing an online multiplayer game in Flutter called Fibula Wars.
Updated on December 21, 2022Comments
-
Leonardo da Silva over 1 year
I forked a plugin with the intent to make an update to use the embedding v2 for Android. But when I opened the android folder on Android Studio it does not find Flutter. It fails to import these classes:
import io.flutter.plugin.common.MethodChannel; import io.flutter.plugin.common.MethodChannel.MethodCallHandler; import io.flutter.plugin.common.MethodChannel.Result; import io.flutter.plugin.common.MethodCall; import io.flutter.plugin.common.PluginRegistry.Registrar;
Is there anything I am missing to edit the Android part of a Flutter plugin?
This is the plugin I am trying to update: https://github.com/lslv1243/launch_review
Thanks in advance!
-
Leonardo da Silva almost 4 yearsI do have these installed
-
Leonardo da Silva almost 4 yearsI am using mac and it is called "Preferences" instead of "Settings". But when I go to "Languages & Frameworks" I don't have an option called "Flutter". I do have installed both Flutter and Dart plugins in my Android Studio. Do you know what could be missing?
-
Leonardo da Silva almost 4 yearsYour response is correct. My Dart version was incompatible with the Android Studio version. I updated it and it is working now. I will just check if the error goes away.
-
Leonardo da Silva almost 4 yearsI provided the SDK path i.ibb.co/xCS2NgM/Captura-de-Tela-2020-06-03-a-s-12-00-31.png but the error did not go away i.ibb.co/qNzjS4k/Captura-de-Tela-2020-06-03-a-s-12-00-53.png
-
Tadeo Hepperle over 2 yearsThanks a lot, that worked for me!
-
Alexandra Damaschin over 2 yearsBut why it's working to open it from plugin/example/android/build.gradle and not working from plugin/android/build.gradle ?