flutter-intellij icon indicating copy to clipboard operation
flutter-intellij copied to clipboard

Autocomplete does not work in Android Studio

Open andrasferenczi opened this issue 7 years ago • 21 comments

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.

andrasferenczi avatar May 06 '19 06:05 andrasferenczi

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 avatar May 06 '19 15:05 devoncarew

@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 avatar May 06 '19 17:05 andrasferenczi

@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.

devoncarew avatar May 06 '19 18:05 devoncarew

Is autocomplete available in Android Studio now?

akshananda avatar Jul 25 '19 21:07 akshananda

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.

carochao avatar Mar 03 '20 00:03 carochao

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 !!!

jomesili avatar May 04 '20 13:05 jomesili

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.

ravichaudhary8434 avatar Jun 11 '20 06:06 ravichaudhary8434

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.

ghost avatar Jul 29 '20 13:07 ghost

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

KCCoders avatar Sep 20 '20 20:09 KCCoders

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

Shubhangi3007 avatar Oct 16 '20 08:10 Shubhangi3007

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

tharwatsamy avatar Dec 01 '20 08:12 tharwatsamy

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

vovahost avatar Dec 18 '20 11:12 vovahost

  • 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

Muzm avatar Jan 18 '21 11:01 Muzm

  • 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.

jack34142 avatar Jan 19 '21 03:01 jack34142

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 .

Shubhangi3007 avatar Jan 20 '21 10:01 Shubhangi3007

@shubhangijadhav30 @jack34142 what's your OS? look like this problem only happened in windows. my macOS colleague that work with me in same project, autocomplete work fine in their computer.

Muzm avatar Jan 21 '21 07:01 Muzm

@Muzm My OS is Win10, maybe it just happen on windows. My colleague use macOS, it work fine.

@shubhangijadhav30 I tried build a new project, and copy the original folder "lib" to the new project. The code completion was still not work.

I think some spefic code will make it happen. I'll try to find it.

jack34142 avatar Jan 21 '21 10:01 jack34142

[](url)

Devil2020 avatar Jan 23 '22 08:01 Devil2020

I have an issue with auto complete text view. Posted a question on stack. can anyone pl check it?

rafey022 avatar Aug 06 '22 04:08 rafey022

Auto complete does not work on my M2 after installing android studio

crataristo4 avatar Aug 23 '23 09:08 crataristo4