Unclear how to open a Flutter project in Android Studio
See original GitHub issue@yjbanov commented on Wed Jan 31 2018
A Flutter project has multiple .gradle
files and it’s very easy to open a wrong one when opening a Flutter project for the first time. Android Studio will happily open the file, but many features will not be available. For example, Java code completion may not work, you can’t start a Flutter app from within Android Studio, etc. We need to document it on our site, and perhaps get some assistance from the Flutter plugin itself.
The docs should probably go here: https://flutter.io/using-ide/
/cc @devoncarew @Sfshaza
@sethladd commented on Wed Jan 31 2018
@devoncarew commented on Wed Jan 31 2018
We do plan to make opening projects in Android Studio work better in the near term; /cc @stevemessick.
@stevemessick commented on Tue Feb 06 2018
There are actually a number of issues here, many of which should be documented, if not fixed.
-
Java code completion will be improved in the near term; the class-path needs to be augmented. That’s a code fix, but a doc update should describe how to add more class-path entries when the user includes new dependencies in their Java code. (We can’t anticipate everything.)
-
If you open a Flutter project as the project-root in Android Studio, and you have the Flutter plugin installed, then you should be able to launch a Flutter app (just like IntelliJ); if not that’s a bug. Opening something below the Flutter root in Android Studio will not give you access to Flutter functionality.
-
Full support for Gradle requires opening the Android module as the project-root in Android Studio. We’d like Gradle support to be available from the Flutter project-root but that apparently requires changing the Android Studio code itself (not happening soon).
-
IntelliJ has an
Open in Android Studio
menu option available when the Android module is selected. We will add that to Android Studio, which already has the Xcode equivalent.
@Purus commented on Fri Mar 09 2018
I am trying to edit an existing plugin(share) to add a feature for a PR. I am facing issues opening the project in Android Studio and IntelliJ IDEA(has Flutter plugin). The flutter packages are not recognized and it looks like a plain file instead of Java file.
@Purus commented on Fri Mar 09 2018
How does Google team work on the plugins?
@yjbanov commented on Fri Mar 09 2018
@Purus, you might be hitting the exact issue described here. There are multiple gradle files, and it’s not obvious which one you are supposed to open. You are probably opening a wrong one.
@Purus commented on Sat Mar 10 2018
Is there anything that can I do to start working on my PR? I don’t see many gradle files in the share plugin directory.
@yjbanov commented on Mon Mar 12 2018
@Purus, you can coordinate with @devoncarew and/or @stevemessick on fixing this (mostly to make sure nobody else is already working on this). The plugin code is https://github.com/flutter/flutter-intellij.
@stevemessick commented on Mon Mar 12 2018
@Purus there is more info here: https://github.com/flutter/flutter-intellij/blob/master/docs/android.md
That doc is an expansion of my previous comment in this thread. It really should be added to the Flutter docs, as @yjbanov mentioned originally.
@Purus commented on Mon Mar 12 2018
Thanks for the response. It’s helpful.
The dependencies section is still unclear. Some sample screenshots and the path for the appcompat-v7 library would be helpful for newcomers.
Issue Analytics
- State:
- Created 5 years ago
- Reactions:1
- Comments:6 (1 by maintainers)
Top GitHub Comments
I tried following “Creating a new project from existing source code” from the Flutter site (https://flutter.dev/docs/development/tools/android-studio) but AS basically just overwrote my project. Tried importing it but I’m unable to run it. Run button is disabled.
Is it not straightforward to import existing Flutter projects in AS?
Still an issue in Android Studio 4.0.2 for Windows. A large number of developers are using VS Code so this problem is pretty major and very annoying. It seems like I should be able to import the project and point AS to the pubspec.yaml.