This article is about fixing error when Unable to run a Flutter app because even Device File Explorer can detect it
  • 05-Feb-2023
Lightrun Team
Author Lightrun Team
Share
This article is about fixing error when Unable to run a Flutter app because even Device File Explorer can detect it

Unable to run a Flutter app because even Device File Explorer can detect it in Flutter Flutter IntelliJ

Lightrun Team
Lightrun Team
05-Feb-2023

Explanation of the problem

The user is attempting to run a Flutter application on a development laptop which is already set up for device connection. However, the deployment of the application is failing as the Run button indicates that there are no connected devices present.

Contrarily, the Device File Explorer tab is able to browse the files on the connected device, suggesting that the connection is established and functional. Additionally, the Flutter CLI tool is able to detect the connected device, as demonstrated in the code block below.

C:\Users\pcdinh>flutter upgrade
Upgrading Flutter from D:\dev\flutter...
From https://github.com/flutter/flutter
   0260642fc..1c3f6a851  master     -> origin/master
Updating 0260642fc..1c3f6a851
 2 files changed, 31 insertions(+), 1 deletion(-)

Upgrading engine...
Updating flutter tool...
Already up-to-date.

Flutter 0.2.12-pre.29 • channel master • https://github.com/flutter/flutter.git
Framework • revision 0260642fc5 (6 hours ago) • 2018-04-12 21:16:39 -0700
Engine • revision 76cb311d9c
Tools • Dart 2.0.0-dev.47.0.flutter-f76dad0adc

The steps to reproduce the issue are outlined as follows: launch Android Studio with the latest Flutter plugin, edit code, connect the device and ensure connection, press the “Run” icon. The expected outcome is the deployment of the application to the connected device, but instead, a dialog appears with the message “No connected devices found; please connect a device, or see flutter.io/setup for getting started instructions.” A screenshot of the issue can be found at the following URL: https://imgur.com/a/qEJrR. The version information of relevant tools and components is also provided in a code block below.

D:\dev\flutter\bin\flutter.bat --no-color doctor
Doctor summary (to see all details, run flutter doctor -v):
[√] Flutter (Channel master, v0.2.12-pre.30, on Microsoft Windows [Version 10.0.16299.309], locale en-US)
[!] Android toolchain - develop for Android devices (Android SDK 27.0.3)
    X Android license status unknown.
[√] Android Studio (version 3.1)
[√] IntelliJ IDEA Community Edition (version 2017.3)
[√] VS Code, 64-bit edition (version 1.22.1)
[√] Connected devices (1 available)
Android Studio 3.1.1
Flutter plugin 23.2.2

Troubleshooting with the Lightrun Developer Observability Platform

Getting a sense of what’s actually happening inside a live application is a frustrating experience, one that relies mostly on querying and observing whatever logs were written during development.
Lightrun is a Developer Observability Platform, allowing developers to add telemetry to live applications in real-time, on-demand, and right from the IDE.

  • Instantly add logs to, set metrics in, and take snapshots of live applications
  • Insights delivered straight to your IDE or CLI
  • Works where you do: dev, QA, staging, CI/CD, and production

Start for free today

Problem solution for Unable to run a Flutter app because <no devices> even Device File Explorer can detect it in Flutter Flutter IntelliJ

The issue described in the problem is that the button “Run” in Android Studio with the latest Flutter plugin is unable to deploy the Flutter app to the connected device even though the device is recognized by the system. This issue occurs because the “Run” feature in Android Studio is unable to find the connected device, and as a result, displays a message that states “No connected devices found.”

Understanding the solution The solution to this issue involves modifying the configuration of the Flutter and Android SDK tools. In the Stack Overflow answer linked in the previous answer, the proposed solution is to set the “android-sdk” value in the Flutter config. The exact steps involved in this solution may vary based on the individual’s setup, but the idea is to resolve the issue by modifying the configuration of the tools so that the “Run” feature in Android Studio can detect the connected device.

Setting the “android-sdk” value The steps involved in setting the “android-sdk” value in the Flutter config are fairly straightforward. First, the current value of the “ANDROID_HOME” environment variable is checked using the “echo $ANDROID_HOME” command. Next, the “flutter config –android-sdk” command is executed, followed by the path to the Android SDK, which sets the “android-sdk” value in the Flutter config. After executing these steps, the individual should be able to deploy the Flutter app to the connected device directly from Android Studio without encountering the “No connected devices found” error.

Other popular problems with Flutter Flutter IntelliJ

Problem: Flutter IntelliJ not recognizing the Flutter SDK

One of the most common problems that Flutter IntelliJ users encounter is the issue of the development environment not recognizing the Flutter SDK. This issue often arises when the Flutter SDK has not been properly installed or when the environment variables pointing to the Flutter SDK have not been set up correctly. As a result, IntelliJ is unable to find the Flutter SDK, leading to a range of errors and issues that can prevent developers from building and testing their apps.

Solution:

To resolve this issue, the first step is to ensure that the Flutter SDK has been installed correctly. If it has been installed correctly, the next step is to set up the environment variables pointing to the Flutter SDK. This can be done by modifying the PATH environment variable and adding the path to the Flutter SDK. Once the environment variables have been set up correctly, IntelliJ should be able to recognize the Flutter SDK and developers should be able to build and test their apps without any issues.

Problem: Flutter IntelliJ failing to build the project

Another common problem that Flutter IntelliJ users encounter is the issue of the development environment failing to build the project. This issue can be caused by a range of factors, including missing dependencies, incorrect configuration settings, or issues with the Flutter or Android SDKs. As a result, developers may find that their project fails to build, preventing them from testing and deploying their apps.

Solution:

To resolve this issue, the first step is to ensure that all dependencies have been properly installed and configured. This can be done by reviewing the dependencies listed in the pubspec.yaml file and making sure that they have been installed and configured correctly. The next step is to review the configuration settings for the Flutter and Android SDKs and make sure that they are set up correctly. If necessary, developers can also try reinstalling the Flutter or Android SDKs to resolve any issues that may be preventing the project from building.

Problem: Flutter IntelliJ not updating the widgets tree

One of the more frustrating problems that Flutter IntelliJ users encounter is the issue of the development environment not updating the widgets tree when changes are made to the code. This can make it difficult for developers to see the effects of their changes and to debug any issues that may arise. This issue can be caused by a range of factors, including issues with the Flutter framework, the IntelliJ development environment, or the Flutter IntelliJ plugin.

Solution:

To resolve this issue, the first step is to ensure that the Flutter framework has been installed and configured correctly. This can be done by running the flutter doctor command to check the status of the Flutter environment. The next step is to review the configuration settings for the IntelliJ development environment and make sure that they are set up correctly. If necessary, developers can also try reinstalling the Flutter IntelliJ plugin to resolve any issues that may be preventing the development environment from updating the widgets tree.

A brief introduction to Flutter Flutter IntelliJ

Flutter IntelliJ is a set of plugins for the IntelliJ IDEA development environment that aims to make it easier to develop applications using the Flutter framework. This includes features such as code completion, syntax highlighting, and debugging capabilities that are specifically tailored to the needs of Flutter developers. Additionally, it provides an integrated environment for developers to work with both the Flutter framework and Dart programming language, making the process of writing, testing, and deploying Flutter applications smoother and more efficient.

One of the key benefits of using Flutter IntelliJ is the improved workflow it provides. With its rich set of features, developers can write, debug, and deploy Flutter applications more quickly and easily than with other development environments. For example, it provides a visual layout editor that enables developers to see the visual changes they make to their app in real-time, which can save significant time and effort when designing the user interface. Additionally, the IntelliJ platform offers seamless integration with popular tools and services, such as GitHub, GitLab, and Bitbucket, making it easy for developers to manage their code repositories and collaborate with other developers on their projects.

Most popular use cases for Flutter Flutter IntelliJ

  1. Building Native Mobile Applications: Flutter IntelliJ provides a fast and powerful platform for building high-performance, cross-platform native mobile applications for iOS and Android using a single codebase. With its rich widget library, customizable design, and high-speed execution, developers can create visually appealing and smooth-running applications that deliver an excellent user experience.
  2. Streamlining Development Workflow: Flutter IntelliJ integrates seamlessly with popular development tools such as IntelliJ IDEA and Android Studio, enabling developers to work efficiently and effectively in a unified development environment. With a vast range of tools for debugging, testing, and deploying applications, developers can streamline their workflow, improve their productivity, and focus on delivering high-quality applications to their users.
  3. Writing Clean, Maintainable Code: Flutter IntelliJ emphasizes the importance of writing clean, maintainable, and well-documented code, making it easy for developers to create and maintain their applications over time. The platform provides advanced code-editing features, including syntax highlighting, code completion, and automatic error detection, enabling developers to write high-quality code quickly and efficiently. Additionally, the platform supports popular programming languages such as Dart, making it easy for developers to get started, even if they have no prior experience with the platform.
Share

It’s Really not that Complicated.

You can actually understand what’s going on inside your live applications.

Try Lightrun’s Playground

Lets Talk!

Looking for more information about Lightrun and debugging?
We’d love to hear from you!
Drop us a line and we’ll get back to you shortly.

By submitting this form, I agree to Lightrun’s Privacy Policy and Terms of Use.