Flutter-intellij: Autocomplete does not work in Android Studio

Created on 6 May 2019  Â·  15Comments  Â·  Source: flutter/flutter-intellij

Steps to Reproduce

_Please tell us what you were doing and what went wrong_

  • Create a new flutter project
  • Create src folder in lib with baz.dart and foo.dart files
  • Add this to foo.dart: class Foo {}
  • Start typing in baz.dart: class Bar extends Fo

Android Studio does not have autocomplete:

android_studio

Visual Studio Code does have:

visual_studio_code

IntelliJ Ultimate also does:

intellij

Version info

Please paste the output of running flutter doctor -v here (available from the command
line or from Tools > Flutter > Flutter Doctor). It will provide the version of the
Flutter framework as well as of the IntelliJ plugin.

[√] Flutter (Channel dev, v1.5.8, on Microsoft Windows [Version 10.0.17763.475], locale en-US)
    • Flutter version 1.5.8 at C:\Users\Meee3\Documents\flutter_v1.2.1_stable\flutter
    • Framework revision 0ba67226ee (11 days ago), 2019-04-24 17:18:28 -0700
    • Engine revision c63d1cf9c9
    • Dart version 2.3.0 (build 2.3.0-dev.0.1 1f1592edce)


[√] Android toolchain - develop for Android devices (Android SDK version 28.0.3)
    • Android SDK at C:\Users\Meee3\AppData\Local\Android\sdk
    • Android NDK location not configured (optional; useful for native profiling support)
    • Platform android-28, build-tools 28.0.3
    • Java binary at: C:\Users\Meee3\AppData\Local\JetBrains\Toolbox\apps\AndroidStudio\ch-0\183.5452501\jre\bin\java
    • Java version OpenJDK Runtime Environment (build 1.8.0_152-release-1343-b01)
    • All Android licenses accepted.

[√] Android Studio (version 3.4)
    • Android Studio at C:\Users\Meee3\AppData\Local\JetBrains\Toolbox\apps\AndroidStudio\ch-0\183.5452501
    • Flutter plugin version 35.2.1
    • Dart plugin version 183.6270
    • Java version OpenJDK Runtime Environment (build 1.8.0_152-release-1343-b01)

[√] IntelliJ IDEA Ultimate Edition (version 2019.1)
    • IntelliJ at C:\Users\Meee3\AppData\Local\JetBrains\Toolbox\apps\IDEA-U\ch-0\191.6707.61
    • Flutter plugin version 35.2.3
    • Dart plugin version 191.7019

[√] VS Code (version 1.33.1)
    • VS Code at C:\Users\Meee3\AppData\Local\Programs\Microsoft VS Code
    • Flutter extension version 2.26.1

[!] Connected device
    ! No devices available

! Doctor found issues in 1 category.

If I switch back to the stable channel, there is no difference in autocomplete.

Checking Dart SDK version...
Downloading Dart SDK from Flutter engine 3757390fa4b00d2d261bfdf5182d2e87c9113ff9...
Unzipping Dart SDK...
Building flutter tool...
Running pub upgrade...
[√] Flutter (Channel stable, v1.2.1, on Microsoft Windows [Version 10.0.17763.475], locale en-US)
    • Flutter version 1.2.1 at C:\Users\Meee3\Documents\flutter_v1.2.1_stable\flutter
    • Framework revision 8661d8aecd (3 months ago), 2019-02-14 19:19:53 -0800
    • Engine revision 3757390fa4
    • Dart version 2.1.2 (build 2.1.2-dev.0.0 0a7dcf17eb)

[√] Android toolchain - develop for Android devices (Android SDK version 28.0.3)
    • Android SDK at C:\Users\Meee3\AppData\Local\Android\sdk
    • Android NDK location not configured (optional; useful for native profiling support)
    • Platform android-28, build-tools 28.0.3
    • Java binary at: C:\Users\Meee3\AppData\Local\JetBrains\Toolbox\apps\AndroidStudio\ch-0\183.5452501\jre\bin\java
    • Java version OpenJDK Runtime Environment (build 1.8.0_152-release-1343-b01)
    • All Android licenses accepted.

[√] Android Studio (version 3.4)
    • Android Studio at C:\Users\Meee3\AppData\Local\JetBrains\Toolbox\apps\AndroidStudio\ch-0\183.5452501
    • Flutter plugin version 35.2.1
    • Dart plugin version 183.6270
    • Java version OpenJDK Runtime Environment (build 1.8.0_152-release-1343-b01)

[√] IntelliJ IDEA Ultimate Edition (version 2019.1)
    • IntelliJ at C:\Users\Meee3\AppData\Local\JetBrains\Toolbox\apps\IDEA-U\ch-0\191.6707.61
    • Flutter plugin version 35.2.3
    • Dart plugin version 191.7019

[√] VS Code (version 1.33.1)
    • VS Code at C:\Users\Meee3\AppData\Local\Programs\Microsoft VS Code
    • Flutter extension version 2.26.1

[!] Connected device
    ! No devices available

! Doctor found issues in 1 category.

As a note:

I of course do not need Android Studio and IntelliJ at the same time, I just spent too much time trying to establish autocomplete in Android Studio that I have downloaded everything possible and could not imagine there was a difference between any IDEs, let alone IntelliJ and Android Studio.

Most helpful comment

Yes, it is, if the autocomplete isn't working for you in Android Studio, just press File and uncheck the Power save mode, it should work fine after that.

All 15 comments

Thanks for the report! I believe this is working as intended. Android Studio has an older version of the Dart plugin (183.6270) than IntelliJ (191.7019). That newer Dart plugin supports the feature of the analysis server that shows completions for symbols that are not in scope. If you select one of these symbols, your imports will be updated for you automatically.

As Android Studio revs, and moves to a version of the IntelliJ platforms that supports the new Dart plugin, Android Studio will get this feature as well.

@devoncarew

I just had to let you know about this problem, as I had assumed Android Studio is the best supported platform. This seemed to be a major issue for me and a very disheartening introduction to Flutter.

Thanks for your response, I'll stick to IntelliJ then.

@andrasferenczi, understood, and thanks for the feedback. The ability for code completion to offer symbols that aren't yet in scope, and automatically fix up imports, is a bigger feature for us. Due to the number of platforms and versions we support it's not rolling out evenly across all IDEs. It will be available in Android Studio once that IDE moves its base IntelliJ platform version to 2019.1.

Is autocomplete available in Android Studio now?

Yes, it is, if the autocomplete isn't working for you in Android Studio, just press File and uncheck the Power save mode, it should work fine after that.

Yes, it is, if the autocomplete isn't working for you in Android Studio, just press File and uncheck the Power save mode, it should work fine after that.

This worked !!!

Yes, it is, if the autocomplete isn't working for you in Android Studio, just press File and uncheck the Power save mode, it should work fine after that.

Thank You so much for this solution.

Note in case anyone hits my sticking point. I put the dependency declaration under dev_dependencies rather than dependencies in my pubspec. The use fo the code compiled and ran fine, but the autocomplete didn't work until I moved it to the dependencies area. A silly moment for me, but maybe useful for others if just starting.

checking and then un-checking File > Power Save Mode made autocomplete start working again for me too.

Yes, it is, if the autocomplete isn't working for you in Android Studio, just press File and uncheck the Power save mode, it should work fine after that.

Still I face the same problem

no suggestion out of the scope appears when i run the project every thing seems to be fine before i run it

Do you have any suggestions how to fix code completion.
In my case:

  • I restart Android Studio and open my Flutter project, and code completion works fine.
  • I run my app on the Emulator
  • Now code completion doesn't work anymore

Running the app somehow breaks Code completion, maybe it has something to do with the new DevTools integration in Android Studio, but I'm just guessing here.
Please help.
image
image
image

ezgif-2-ac4f160cc18e

  • I restart Android Studio and open my Flutter project, and code completion works fine.
  • I run my app on the Emulator
  • Now code completion doesn't work anymore

exactly the same problem! I been search solution for month and nothing was found.
before hit the run/debug button widget and import autocomplete was good, after run/debug it all broken.
restart the inteillj/android studio autocomplete will be back, only when I NOT CLICKED the run/debug button.

here is my flutter doctor and flutter plugin version:
image
image

edit: after reset my OS(win 10) and reinstall flutter 1.22.5, the problem still exist

  • I restart Android Studio and open my Flutter project, and code completion works fine.
  • I run my app on the Emulator
  • Now code completion doesn't work anymore

I have the same question,
but it's just happen on one project.
My other projects do not have this problem, I don't know why.

You just create a new project and start working there !! Auto completion of code will surely work !! It happened with me and my friend but for only 1 project our other projects do not have this problem .

Was this page helpful?
0 / 5 - 0 ratings