Flutter-intellij: Flutter Intellij/Android Studio plugin shows "no devices" while cli and VSCode show all devices

Created on 20 Jun 2020  Â·  24Comments  Â·  Source: flutter/flutter-intellij

Problem

Both IntelliJ (2020.1C) and Android Studio (4.0) with Flutter Plugin v46 consistently show "no-devices", even though the flutter devices and VSCode show all devices (web / Android)

Running on MacOS Catalina 10.15.5

Steps to Reproduce

This is consistent. Things I've tried to resolve:

  1. Restart the IDEs
  2. Execute flutter config --android-sdk /path/to/sdk
  3. Execute flutter config --android-studio-dir /path/to/studio
  4. Uninstall and reinstall the plugin
  5. Create a new Android AVD
  6. Start the AVD from the device pull-down menu
  7. Starting the IDE with the AVD already running
  8. Adding Android SDK to the system path (so adb works from anywhere

Logs

flutter config output:

Settings:
  enable-macos-desktop: true (Unavailable)
  enable-web: true
  android-sdk: /Users/lior/dev/android_sdk
  android-studio-dir: /Applications/Android Studio.app

flutter doctor -v output:

[✓] Flutter (Channel beta, 1.19.0-4.1.pre, on Mac OS X 10.15.5 19F101, locale en-US)
    • Flutter version 1.19.0-4.1.pre at /Users/lior/dev/flutter
    • Framework revision f994b76974 (11 days ago), 2020-06-09 15:53:13 -0700
    • Engine revision 9a28c3bcf4
    • Dart version 2.9.0 (build 2.9.0-14.1.beta)

[✓] Android toolchain - develop for Android devices (Android SDK version 30.0.0)
    • Android SDK at /Users/lior/dev/android_sdk
    • Platform android-30, build-tools 30.0.0
    • ANDROID_SDK_ROOT = /Users/lior/dev/android_sdk
    • Java binary at: /Applications/Android Studio.app/Contents/jre/jdk/Contents/Home/bin/java
    • Java version OpenJDK Runtime Environment (build 1.8.0_242-release-1644-b3-6222593)
    • All Android licenses accepted.

[✗] Xcode - develop for iOS and macOS
    ✗ Xcode installation is incomplete; a full installation is necessary for iOS development.
      Download at: https://developer.apple.com/xcode/download/
      Or install Xcode via the App Store.
      Once installed, run:
        sudo xcode-select --switch /Applications/Xcode.app/Contents/Developer
        sudo xcodebuild -runFirstLaunch
    ✗ CocoaPods not installed.
        CocoaPods is used to retrieve the iOS and macOS platform side's plugin code that responds to your plugin usage on the Dart side.
        Without CocoaPods, plugins will not work on iOS or macOS.
        For more info, see https://flutter.dev/platform-plugins
      To install:
        sudo gem install cocoapods

[✓] Chrome - develop for the web
    • Chrome at /Applications/Google Chrome.app/Contents/MacOS/Google Chrome

[✓] Android Studio (version 4.0)
    • Android Studio at /Applications/Android Studio.app/Contents
    • Flutter plugin version 46.0.2
    • Dart plugin version 193.7361
    • Java version OpenJDK Runtime Environment (build 1.8.0_242-release-1644-b3-6222593)

[✓] IntelliJ IDEA Community Edition (version 2020.1.2)
    • IntelliJ at /Applications/IntelliJ IDEA CE.app
    • Flutter plugin version 46.0.3
    • Dart plugin version 201.7846.93

[✓] VS Code (version 1.46.1)
    • VS Code at /Applications/Visual Studio Code.app/Contents
    • Flutter extension version 3.11.0

[✓] Connected device (2 available)
    • Web Server • web-server • web-javascript • Flutter Tools
    • Chrome     • chrome     • web-javascript • Google Chrome 83.0.4103.106

Most helpful comment

@stevemessick
I install xcode and it works!
However, I don't understand why xcode is required to run flutter on my android device.
This does not make any sence at all, because I can run flutter in vscode without xcode.
Please look into this

@pennzht
Please try installing xcode flowing the flutter doctor's instrution and see if it can work

[!] Xcode - develop for iOS and macOS
    ✗ Xcode installation is incomplete; a full installation is necessary for iOS development.
      Download at: https://developer.apple.com/xcode/download/
      Or install Xcode via the App Store.
      Once installed, run:
        sudo xcode-select --switch /Applications/Xcode.app/Contents/Developer
        sudo xcodebuild -runFirstLaunch
    • CocoaPods version 1.9.3

All 24 comments

This should be fixed in the current dev channel build.

Thank you, but this is still not working for me. I've updated the plugin to 47.0.3-dev.4 and restarted the IDE.

This the output from flutter devices in terminal:

3 connected devices:

Android SDK built for x86 • emulator-5554 • android-x86    • Android 10 (API 29) (emulator)
Web Server                • web-server    • web-javascript • Flutter Tools
Chrome                    • chrome        • web-javascript • Google Chrome 83.0.4103.106

The plugin UI shows "Loading..." in the device-dropdown, followed by the main.dart configuration, followed by a "No devices" dropdown.

@helin24

We've had some success with closing the re-opening the project without restarting the IDE. You might try the stable channel of the SDK. The problem was caused by a change to the command line tool, but I'm not sure if that change made it into stable yet.

This is working for me with latest master of the engine and the dev plugin.

flutter doctor -v
[✓] Flutter (Channel master, 1.20.0-1.0.pre.176, on Mac OS X 10.15.5 19F101, locale en-US)
    • Flutter version 1.20.0-1.0.pre.176 at /Users/lior/dev/flutter
    • Framework revision 37db92beeb (42 minutes ago), 2020-06-23 15:48:37 -0700
    • Engine revision 2b6c71c4d3
    • Dart version 2.9.0 (build 2.9.0-18.0.dev 5a6c1e5158)

[✓] Android toolchain - develop for Android devices (Android SDK version 30.0.0)
    • Android SDK at /Users/lior/dev/android_sdk
    • Platform android-30, build-tools 30.0.0
    • ANDROID_SDK_ROOT = /Users/lior/dev/android_sdk
    • Java binary at: /Applications/Android Studio.app/Contents/jre/jdk/Contents/Home/bin/java
    • Java version OpenJDK Runtime Environment (build 1.8.0_242-release-1644-b3-6222593)
    • All Android licenses accepted.

[✓] Xcode - develop for iOS and macOS (Xcode 12.0)
    • Xcode at /Applications/Xcode-beta.app/Contents/Developer
    • Xcode 12.0, Build version 12A6159
    • CocoaPods version 1.9.3

[✓] Chrome - develop for the web
    • Chrome at /Applications/Google Chrome.app/Contents/MacOS/Google Chrome

[✓] Android Studio (version 4.0)
    • Android Studio at /Applications/Android Studio.app/Contents
    • Flutter plugin version 46.0.2
    • Dart plugin version 193.7361
    • Java version OpenJDK Runtime Environment (build 1.8.0_242-release-1644-b3-6222593)

[✓] IntelliJ IDEA Community Edition (version 2020.1.2)
    • IntelliJ at /Applications/IntelliJ IDEA CE.app
    • Flutter plugin version 47.0.3-dev.4
    • Dart plugin version 201.7846.93

[✓] VS Code (version 1.46.1)
    • VS Code at /Applications/Visual Studio Code.app/Contents
    • Flutter extension version 3.11.0

[✓] Connected device (3 available)
    • macOS desktop • macos      • darwin-x64     • Mac OS X 10.15.5 19F101
    • Web Server    • web-server • web-javascript • Flutter Tools
    • Chrome        • chrome     • web-javascript • Google Chrome 83.0.4103.116

• No issues found!

i've got same issue...
i set sdks into project structure and i tried to switch flutter channel from stable to dev but nothing happens.

Schermata 2020-06-25 alle 12 31 21

Schermata 2020-06-25 alle 12 31 35

i think that issue involved only flutter plugin because flutter sdk works well.
i use it via vscode and i can run a flutter app via vscode or terminal.

flutter doctor said that everything is ok (apart xcode but i don't use it) and it show the physical connected device.

from my android studio i can only run java or kotlin android app (not flutter app).
only with flutter plugin (both in android studio and intellij) i cannot run app directly (but i can do it via intergated terminal).

Thanks for the update @liorgonnen !

@pminel as mentioned above this appears to be fixed in the dev channel of the plugin (at least for the master channel of the SDK). We'll be publishing a new stable release this week, which will have that fix.

Using the master channel of the SDK and dev channel of the plugin does not fixed this issue.
This has wasted 4 of my days. @stevemessick

I updated the flutter plugin to 47.0.2 in AS4.0. This dose not help either.

@helin24

@stevemessick
I install xcode and it works!
However, I don't understand why xcode is required to run flutter on my android device.
This does not make any sence at all, because I can run flutter in vscode without xcode.
Please look into this

@pennzht
Please try installing xcode flowing the flutter doctor's instrution and see if it can work

[!] Xcode - develop for iOS and macOS
    ✗ Xcode installation is incomplete; a full installation is necessary for iOS development.
      Download at: https://developer.apple.com/xcode/download/
      Or install Xcode via the App Store.
      Once installed, run:
        sudo xcode-select --switch /Applications/Xcode.app/Contents/Developer
        sudo xcodebuild -runFirstLaunch
    • CocoaPods version 1.9.3

Downgrade flutter to version 1.18.0-11.1.pre resolved for me...

thanks @cyberdemon8.
with flutter 1.18.0-11.1.pre everything works also with android studio and i can run flutter app from it.
for now is the best workaround that i've tried.
i hope soon in a stable channel update to fix the flutter issue.

Please try installing xcode flowing the flutter doctor's instrution and see if it can work

[!] Xcode - develop for iOS and macOS
    ✗ Xcode installation is incomplete; a full installation is necessary for iOS development.
      Download at: https://developer.apple.com/xcode/download/
      Or install Xcode via the App Store.
      Once installed, run:
        sudo xcode-select --switch /Applications/Xcode.app/Contents/Developer
        sudo xcodebuild -runFirstLaunch
    • CocoaPods version 1.9.3

As you said, it did work well!!!
Thank you very much!

For people seeing this issue, a fix for this has landed in flutter master (https://github.com/flutter/flutter/pull/60546), and is being considered as a hot fix cherry-pick to more stable versions of flutter.

cc @helin24 @stevemessick

(For people following along, the issue is triggered when XCode is not installed)

fixed in 1.17.5. beta build (1.19) coming.

This is working for me with latest master of the engine and the dev plugin.

flutter doctor -v
[✓] Flutter (Channel master, 1.20.0-1.0.pre.176, on Mac OS X 10.15.5 19F101, locale en-US)
    • Flutter version 1.20.0-1.0.pre.176 at /Users/lior/dev/flutter
    • Framework revision 37db92beeb (42 minutes ago), 2020-06-23 15:48:37 -0700
    • Engine revision 2b6c71c4d3
    • Dart version 2.9.0 (build 2.9.0-18.0.dev 5a6c1e5158)

[✓] Android toolchain - develop for Android devices (Android SDK version 30.0.0)
    • Android SDK at /Users/lior/dev/android_sdk
    • Platform android-30, build-tools 30.0.0
    • ANDROID_SDK_ROOT = /Users/lior/dev/android_sdk
    • Java binary at: /Applications/Android Studio.app/Contents/jre/jdk/Contents/Home/bin/java
    • Java version OpenJDK Runtime Environment (build 1.8.0_242-release-1644-b3-6222593)
    • All Android licenses accepted.

[✓] Xcode - develop for iOS and macOS (Xcode 12.0)
    • Xcode at /Applications/Xcode-beta.app/Contents/Developer
    • Xcode 12.0, Build version 12A6159
    • CocoaPods version 1.9.3

[✓] Chrome - develop for the web
    • Chrome at /Applications/Google Chrome.app/Contents/MacOS/Google Chrome

[✓] Android Studio (version 4.0)
    • Android Studio at /Applications/Android Studio.app/Contents
    • Flutter plugin version 46.0.2
    • Dart plugin version 193.7361
    • Java version OpenJDK Runtime Environment (build 1.8.0_242-release-1644-b3-6222593)

[✓] IntelliJ IDEA Community Edition (version 2020.1.2)
    • IntelliJ at /Applications/IntelliJ IDEA CE.app
    • Flutter plugin version 47.0.3-dev.4
    • Dart plugin version 201.7846.93

[✓] VS Code (version 1.46.1)
    • VS Code at /Applications/Visual Studio Code.app/Contents
    • Flutter extension version 3.11.0

[✓] Connected device (3 available)
    • macOS desktop • macos      • darwin-x64     • Mac OS X 10.15.5 19F101
    • Web Server    • web-server • web-javascript • Flutter Tools
    • Chrome        • chrome     • web-javascript • Google Chrome 83.0.4103.116

• No issues found!

OMG! Checkout to the master branch work for me!
It save my day!

flutter/flutter#60546

checkout to the master solve the problem for me.But there comes up a new problem: It build failed when I run flutter run

Launching lib/main.dart on PCT AL10 in debug mode...
Running Gradle task 'assembleDebug'...
Invalid depfile: /Users/joe/Developer/Flutter/project/flutter_demo/.dart_tool/flutter_build/bfa287fea2e393905c130d40922cbc0a/kernel_snapshot.d
Invalid depfile: /Users/joe/Developer/Flutter/project/flutter_demo/.dart_tool/flutter_build/bfa287fea2e393905c130d40922cbc0a/kernel_snapshot.d
Error: Could not resolve the package 'characters' in 'package:characters/characters.dart'.
../../flutter/packages/flutter/lib/src/material/text_field.dart:9:8: Error: Not found: 'package:characters/characters.dart'
import 'package:characters/characters.dart';
       ^
../../flutter/packages/flutter/lib/widgets.dart:18:1: Error: Not found: 'package:characters/characters.dart'
export 'package:characters/characters.dart';
^
../../flutter/packages/flutter/lib/src/rendering/editable.dart:10:8: Error: Not found: 'package:characters/characters.dart'
import 'package:characters/characters.dart';
       ^
../../flutter/packages/flutter/lib/src/services/text_formatter.dart:9:8: Error: Not found: 'package:characters/characters.dart'
import 'package:characters/characters.dart';
       ^
../../flutter/packages/flutter/lib/src/material/text_field.dart:822:61: Error: The getter 'characters' isn't defined for the class 'String'.
Try correcting the name to the name of an existing getter, or defining a getter or field named 'characters'.
  int get _currentLength => _effectiveController.value.text.characters.length;
                                                            ^^^^^^^^^^
../../flutter/packages/flutter/lib/src/material/text_field.dart:824:118: Error: The getter 'characters' isn't defined for the class 'String'.
Try correcting the name to the name of an existing getter, or defining a getter or field named 'characters'.
  bool get _hasIntrinsicError => widget.maxLength != null && widget.maxLength > 0 && _effectiveController.value.text.characters.length > widget.maxLength;
                                                                                                                     ^^^^^^^^^^
../../flutter/packages/flutter/lib/src/rendering/editable.dart:244:64: Error: The getter 'characters' isn't defined for the class 'String'.
Try correcting the name to the name of an existing getter, or defining a getter or field named 'characters'.
       assert(obscuringCharacter != null && obscuringCharacter.characters.length == 1),
                                                               ^^^^^^^^^^
../../flutter/packages/flutter/lib/src/rendering/editable.dart:361:35: Error: The getter 'characters' isn't defined for the class 'String'.
Try correcting the name to the name of an existing getter, or defining a getter or field named 'characters'.
    assert(value != null && value.characters.length == 1);
                                  ^^^^^^^^^^
../../flutter/packages/flutter/lib/src/rendering/editable.dart:567:11: Error: 'Characters' isn't a type.
    final Characters remaining = string.characters.skipWhile((String currentString) {
          ^^^^^^^^^^
../../flutter/packages/flutter/lib/src/rendering/editable.dart:567:41: Error: The getter 'characters' isn't defined for the class 'String'.
Try correcting the name to the name of an existing getter, or defining a getter or field named 'characters'.
    final Characters remaining = string.characters.skipWhile((String currentString) {
                                        ^^^^^^^^^^
../../flutter/packages/flutter/lib/src/rendering/editable.dart:600:47: Error: The getter 'characters' isn't defined for the class 'String'.
Try correcting the name to the name of an existing getter, or defining a getter or field named 'characters'.
    for (final String currentString in string.characters) {
                                              ^^^^^^^^^^
../../flutter/packages/flutter/lib/src/rendering/editable.dart:602:40: Error: The getter 'characters' isn't defined for the class 'String'.
Try correcting the name to the name of an existing getter, or defining a getter or field named 'characters'.
          !_isWhitespace(currentString.characters.first.toString().codeUnitAt(0))) {
                                       ^^^^^^^^^^
../../flutter/packages/flutter/lib/src/services/text_formatter.dart:355:11: Error: 'CharacterRange' isn't a type.
    final CharacterRange iterator = CharacterRange(value.text);
          ^^^^^^^^^^^^^^
../../flutter/packages/flutter/lib/src/services/text_formatter.dart:355:37: Error: Method not found: 'CharacterRange'.
    final CharacterRange iterator = CharacterRange(value.text);
                                    ^^^^^^^^^^^^^^
../../flutter/packages/flutter/lib/src/services/text_formatter.dart:356:20: Error: The getter 'characters' isn't defined for the class 'String'.
Try correcting the name to the name of an existing getter, or defining a getter or field named 'characters'.
    if (value.text.characters.length > maxLength) {
                   ^^^^^^^^^^
../../flutter/packages/flutter/lib/src/services/text_formatter.dart:375:61: Error: The getter 'characters' isn't defined for the class 'String'.
Try correcting the name to the name of an existing getter, or defining a getter or field named 'characters'.
    if (maxLength != null && maxLength > 0 && newValue.text.characters.length > maxLength) {
                                                            ^^^^^^^^^^
../../flutter/packages/flutter/lib/src/services/text_formatter.dart:378:25: Error: The getter 'characters' isn't defined for the class 'String'.
Try correcting the name to the name of an existing getter, or defining a getter or field named 'characters'.
      if (oldValue.text.characters.length == maxLength) {
                        ^^^^^^^^^^
Unhandled exception:
FileSystemException(uri=org-dartlang-untranslatable-uri:package%3Acharacters%2Fcharacters.dart; message=StandardFileSystem only supports file:* and data:* URIs)
#0      StandardFileSystem.entityForUri (package:front_end/src/api_prototype/standard_file_system.dart:33:7)
#1      asFileUri (package:vm/kernel_front_end.dart:659:37)
#2      writeDepfile (package:vm/kernel_front_end.dart:853:21)
<asynchronous suspension>
#3      FrontendCompiler.compile (package:frontend_server/frontend_server.dart:574:15)
<asynchronous suspension>
#4      _FlutterFrontendCompiler.compile (package:flutter_frontend_server/server.dart:43:22)
#5      starter (package:flutter_frontend_server/server.dart:182:27)
#6      main (file:///b/s/w/ir/cache/builder/src/flutter/flutter_frontend_server/bin/starter.dart:9:30)
#7      _startIsolate.<anonymous closure> (dart:isolate-patch/isolate_patch.dart:299:32)
#8      _RawReceivePortImpl._handleMessage (dart:isolate-patch/isolate_patch.dart:168:12)



FAILURE: Build failed with an exception.

* Where:
Script '/Users/joe/Developer/Flutter/flutter/packages/flutter_tools/gradle/flutter.gradle' line: 896

* What went wrong:
Execution failed for task ':app:compileFlutterBuildDebug'.
> Process 'command '/Users/joe/Developer/Flutter/flutter/bin/flutter'' finished with non-zero exit value 1

* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.

* Get more help at https://help.gradle.org

BUILD FAILED in 6s
Exception: Gradle task assembleDebug failed with exit code 1

fixed in 1.17.5. beta build (1.19) coming.

This isn't fixed in 1.17.5 for me :(

Yayyyyy !!! for me, the latest version of the plugin solves the bug even with the latest beta version of flutter without problems ;-)

[✓] Flutter (Channel beta, 1.19.0-4.3.pre, on Mac OS X 10.15.5 19F101, locale it-IT)
    • Flutter version 1.19.0-4.3.pre at /Users/valentino/sdk/flutter
    • Framework revision 8fe7655ed2 (22 ore fa), 2020-07-01 14:31:18 -0700
    • Engine revision 9a28c3bcf4
    • Dart version 2.9.0 (build 2.9.0-14.1.beta)


[✓] Android toolchain - develop for Android devices (Android SDK version 29.0.3)
    • Android SDK at /Users/valentino/Library/Android/sdk
    • Platform android-29, build-tools 29.0.3
    • Java binary at: /Users/valentino/Library/Application Support/JetBrains/Toolbox/apps/AndroidStudio/ch-0/193.6514223/Android Studio.app/Contents/jre/jdk/Contents/Home/bin/java
    • Java version OpenJDK Runtime Environment (build 1.8.0_242-release-1644-b3-6222593)
    • All Android licenses accepted.

[✗] Xcode - develop for iOS and macOS
    ✗ Xcode installation is incomplete; a full installation is necessary for iOS development.
      Download at: https://developer.apple.com/xcode/download/
      Or install Xcode via the App Store.
      Once installed, run:
        sudo xcode-select --switch /Applications/Xcode.app/Contents/Developer
        sudo xcodebuild -runFirstLaunch
    ✗ CocoaPods not installed.
        CocoaPods is used to retrieve the iOS and macOS platform side's plugin code that responds to your plugin usage on the Dart side.
        Without CocoaPods, plugins will not work on iOS or macOS.
        For more info, see https://flutter.dev/platform-plugins
      To install:
        sudo gem install cocoapods

[✓] Chrome - develop for the web
    • Chrome at /Applications/Google Chrome.app/Contents/MacOS/Google Chrome

[✓] Android Studio (version 4.0)
    • Android Studio at /Users/valentino/Library/Application Support/JetBrains/Toolbox/apps/AndroidStudio/ch-0/193.6514223/Android Studio.app/Contents
    • Flutter plugin version 47.1.2
    • Dart plugin version 193.7361
    • Java version OpenJDK Runtime Environment (build 1.8.0_242-release-1644-b3-6222593)

[✓] VS Code (version 1.46.1)
    • VS Code at /Applications/Visual Studio Code.app/Contents
    • Flutter extension version 3.12.0

[✓] Connected device (2 available)
    • Web Server • web-server • web-javascript • Flutter Tools
    • Chrome     • chrome     • web-javascript • Google Chrome 83.0.4103.116

! Doctor found issues in 1 category.

fixed in 1.17.5. beta build (1.19) coming.

Closing this issue since it has been fixed. @GeeJoe @MichaelM97 if you're still having problems, please feel free to open separate issues with flutter doctor output and other details.

Same bug happend to me when I was on flutter 1.22 --> stable channel.
Luckily I was again able to fix this problem, by switching to the dev channel.

Problem:
"no devices" on IntelliJ IDEA 2020.3.1 (Ubuntu 18.04)

flutter doctor
Doctor summary (to see all details, run flutter doctor -v):
[✓] Flutter (Channel stable, 1.22.5, on Linux, locale en_US.UTF-8)

[✓] Android toolchain - develop for Android devices (Android SDK version 29.0.3)
[✓] Android Studio (version 4.0)
[✓] VS Code (version 1.52.1)
[✓] Connected device (2 available)

How to solve:
$ flutter config --android-sdk /path/to/dir/android-sdk
then restart the IDE

Was this page helpful?
0 / 5 - 0 ratings