I'm trying to run a Flutter app on a physical Android device using Visual Studio Code with the Dart Code/Flutter extension (which used to work).
But when I try to start the app, it is stuck at Installing build\app\outputs\apk\app.apk...
and a white screen appears on my phone.
I know that there are already a number of threads on this topic1 2 3, but the suggested solutions did not work for me, including:
- Rebooting my phone and my computer
- Uninstalling the app
flutter clean
- Building the app using
flutter build
, manually installing theapp-debug.apk
* and then starting the app from VS Code again - Uninstalling the app using
adb uninstall
and installingapp.apk
usingadb install
- Clearing cache and storing from the app settings before uninstalling
- Revoking USB debugging authorizations
- Disabling Play Protect on my phone
- Increasing the Logger Buffer Size in my phone's developer options
*after installing the APK file myself, the app worked, but of course I had no debugging capabilities
When I execute flutter run
in the terminal, the app opens on my phone and works fine. However hot reload does not work and only the following is printed out:
$ flutter run -d FA685YJ01209
Launching lib/main.dart on HTC One M9 in debug mode...
Running Gradle task 'assembleDebug'...
Running Gradle task 'assembleDebug'... Done 4.0s
✓ Built build/app/outputs/apk/debug/app-debug.apk.
It is not possible to attach to that process from Visual Studio Code either.
I also tried to start the app on an emulator using Visual Studio Code. In that case, it gets stuck at Syncing files to device Android SDK built for x86...
.
$ flutter doctor -v
[✓] Flutter (Channel stable, v1.12.13+hotfix.8, on Linux, locale en_US.UTF-8)
• Flutter version 1.12.13+hotfix.8 at /opt/flutter
• Framework revision 0b8abb4724 (7 weeks ago), 2020-02-11 11:44:36 -0800
• Engine revision e1e6ced81d
• Dart version 2.7.0
[✓] Android toolchain - develop for Android devices (Android SDK version 29.0.3)
• Android SDK at /home/scriptim/Dev/Android/SDK/
• Android NDK location not configured (optional; useful for native profiling support)
• Platform android-29, build-tools 29.0.3
• Java binary at: /opt/android-studio/jre/bin/java
• Java version OpenJDK Runtime Environment (build 1.8.0_212-release-1586-b4-5784211)
• All Android licenses accepted.
[!] Android Studio (version 3.6)
• Android Studio at /opt/android-studio
✗ Flutter plugin not installed; this adds Flutter specific functionality.
✗ Dart plugin not installed; this adds Dart specific functionality.
• Java version OpenJDK Runtime Environment (build 1.8.0_212-release-1586-b4-5784211)
[✓] Connected device (1 available)
• HTC One M9 • FA685YJ01209 • android-arm64 • Android 7.0 (API 24)
! Doctor found issues in 1 category.