Unable to run windows desktop app on android studio using flutter - android

I'm new to flutter dev and android studio, so basically whenever i run my app on windows(desktop), my app opens for 20sec on windows but then gets closed automatically.
It shows :
"LOST CONNECTION TO DEVICE" ,
I don't know what is the problem !? I didn't even have the app.so file present in any folder, I had to ask a friend to mail me this file, and even after pasting the file in the
build->windows->runner->debug folder, it's showing the same error.
flutter doctor -v result is :
C:\Users\Shaurya>flutter doctor -v
[√] Flutter (Channel stable, 2.10.3, on Microsoft Windows [Version 10.0.19043.1586], locale en-IN)
• Flutter version 2.10.3 at C:\src\flutter\flutter
• Upstream repository https://github.com/flutter/flutter.git
• Framework revision 7e9793dee1 (3 weeks ago), 2022-03-02 11:23:12 -0600
• Engine revision bd539267b4
• Dart version 2.16.1
• DevTools version 2.9.2
[√] Android toolchain - develop for Android devices (Android SDK version 32.0.0)
• Android SDK at C:\Users\Shaurya\AppData\Local\Android\sdk
• Platform android-32, build-tools 32.0.0
• Java binary at: C:\Program Files\Android\Android Studio\jre\bin\java
• Java version OpenJDK Runtime Environment (build 11.0.10+0-b96-7249189)
• All Android licenses accepted.
[√] Chrome - develop for the web
• Chrome at C:\Program Files\Google\Chrome\Application\chrome.exe
[√] Visual Studio - develop for Windows (Visual Studio Community 2022 17.1.1)
• Visual Studio at C:\Program Files\Microsoft Visual Studio\2022\Community
• Visual Studio Community 2022 version 17.1.32228.430
• Windows 10 SDK version 10.0.19041.0
[√] Android Studio (version 2020.3)
• Android Studio at C:\Program Files\Android\Android Studio
• Flutter plugin can be installed from:
https://plugins.jetbrains.com/plugin/9212-flutter
• Dart plugin can be installed from:
https://plugins.jetbrains.com/plugin/6351-dart
• Java version OpenJDK Runtime Environment (build 11.0.10+0-b96-7249189)
[√] VS Code (version 1.65.2)
• VS Code at C:\Users\Shaurya\AppData\Local\Programs\Microsoft VS Code
• Flutter extension version 3.36.0
[√] Connected device (3 available)
• Windows (desktop) • windows • windows-x64 • Microsoft Windows [Version 10.0.19043.1586]
• Chrome (web) • chrome • web-javascript • Google Chrome 99.0.4844.74
• Edge (web) • edge • web-javascript • Microsoft Edge 99.0.1150.46
[√] HTTP Host Availability
• All required HTTP hosts are available
• No issues found!
Please help me out !

Related

Flutter Could not load compiled classes for build file 'build.gradle' from cache

I tried to run my project from laptop, and have ancounted to problem.
What went wrong:
A problem occurred configuring root project 'android'.
Could not load compiled classes for build file 'C:\programming\projects\flutter\android\build.gradle' from cache.
I also use firebase and library flutter_background_geolocation 4.8.3
Flutter doctor -v
[√] Flutter (Channel stable, 3.3.8, on Microsoft Windows [Version 10.0.19044.2251], locale ru-RU)
• Flutter version 3.3.8 on channel stable at C:\flutter
• Upstream repository https://github.com/flutter/flutter.git
• Framework revision 52b3dc25f6 (2 days ago), 2022-11-09 12:09:26 +0800
• Engine revision 857bd6b74c
• Dart version 2.18.4
• DevTools version 2.15.0
[√] Android toolchain - develop for Android devices (Android SDK version 33.0.0)
• Android SDK at C:\Users\user\AppData\Local\Android\sdk
• Platform android-33, build-tools 33.0.0
• Java binary at: C:\Program Files\Android\Android Studio1\jre\bin\java
• Java version OpenJDK Runtime Environment (build 11.0.13+0-b1751.21-8125866)
• All Android licenses accepted.
[√] Chrome - develop for the web
• Chrome at C:\Program Files\Google\Chrome\Application\chrome.exe
[X] Visual Studio - develop for Windows
X Visual Studio not installed; this is necessary for Windows development.
Download at https://visualstudio.microsoft.com/downloads/.
Please install the "Desktop development with C++" workload, including all of its default components
[√] Android Studio (version 2021.3)
• Android Studio at C:\Program Files\Android\Android Studio1
• Flutter plugin can be installed from:
https://plugins.jetbrains.com/plugin/9212-flutter
• Dart plugin can be installed from:
https://plugins.jetbrains.com/plugin/6351-dart
• Java version OpenJDK Runtime Environment (build 11.0.13+0-b1751.21-8125866)
[√] VS Code (version 1.70.2)
• VS Code at C:\Users\user\AppData\Local\Programs\Microsoft VS Code
• Flutter extension version 3.52.0
[√] Connected device (4 available)
• Android SDK built for x86 (mobile) • emulator-5554 • android-x86 • Android 10 (API 29) (emulator)
• Windows (desktop) • windows • windows-x64 • Microsoft Windows [Version 10.0.19044.2251]
• Chrome (web) • chrome • web-javascript • Google Chrome 107.0.5304.107
• Edge (web) • edge • web-javascript • Microsoft Edge 107.0.1418.35
[√] HTTP Host Availability
• All required HTTP hosts are available
! Doctor found issues in 1 category.
i show only error message.
What i can do to fix this problem ?
I already tried to flutter clean, flutter pub cache repair, restart laptop, reinstall android studio, and reinstall android emulator.

can't run flutter app on physical device or emulator

I've been trying to run some basic flutter code on a physical device (was working a few days ago) I am kinda new to flutter and I am left with this error message.
Invalid depfile: /mnt/2d3f0752-b6d9-49f5-94cc-f85e942a8495/home/abdullah/UIA/212/MAD/mad_assignment/.dart_tool/flutter_build/10a98dcd0759222e9209b6893a2ed34e/kernel_snapshot.d
: Error: Not found: 'dart:html'
lib/home.dart:1
import 'dart:html';
[flutter] flutter doctor -v
[✓] Flutter (Channel stable, 2.10.3, on Ubuntu 20.04.4 LTS 5.13.0-44-generic, locale en_US.UTF-8)
• Flutter version 2.10.3 at /home/fawrama/snap/flutter/common/flutter
• Upstream repository https://github.com/flutter/flutter.git
• Framework revision 7e9793dee1 (3 months ago), 2022-03-02 11:23:12 -0600
• Engine revision bd539267b4
• Dart version 2.16.1
• DevTools version 2.9.2
[✓] Android toolchain - develop for Android devices (Android SDK version 33.0.0-rc4)
• Android SDK at /home/fawrama/Android/Sdk
• Platform android-Tiramisu, build-tools 33.0.0-rc4
• Java binary at: /snap/android-studio/121/android-studio/jre/bin/java
• Java version OpenJDK Runtime Environment (build 11.0.12+0-b1504.28-7817840)
• All Android licenses accepted.
[✓] Chrome - develop for the web
• Chrome at google-chrome
[✓] Android Studio (version 2021.1)
• Android Studio at /snap/android-studio/119/android-studio
• Flutter plugin version 65.2.2
• Dart plugin version 211.7808
• Java version OpenJDK Runtime Environment (build 11.0.11+0-b60-7590822)
[✓] Android Studio (version 2021.2)
• Android Studio at /snap/android-studio/121/android-studio
• Flutter plugin version 67.1.2
• Dart plugin version 212.5744
• Java version OpenJDK Runtime Environment (build 11.0.12+0-b1504.28-7817840)
[✓] IntelliJ IDEA Community Edition (version 2022.1)
• IntelliJ at /snap/intellij-idea-community/361
• Flutter plugin can be installed from:
🔨 https://plugins.jetbrains.com/plugin/9212-flutter
• Dart plugin can be installed from:
🔨 https://plugins.jetbrains.com/plugin/6351-dart
[✓] VS Code
• VS Code at /snap/code/current
• Flutter extension version 3.40.0
[✓] Connected device (2 available)
• SM A325F (mobile) • RR8RC0EA1SA • android-arm64 • Android 11 (API 30)
• Chrome (web) • chrome • web-javascript • Google Chrome 102.0.5005.61
[✓] HTTP Host Availability
• All required HTTP hosts are available
• No issues found!
exit code 0
Remove dart:html from main.dart. or replace it with dart:io

Android emulator not visible in flutter devices

I have 2 android emulators, one being BlueStacks and the other, a Google Pixel 4 from Android Studio. When I create a new Flutter app and go to the Devices option, I couldn't see any of the android devices. Also, I tried to look for the devices using flutter devices command, but only Google and Edge appeared. Even I tried to connect BlueStacks using adb connect command, but didn't work. But it does run on Google and Edge. How to make my app android-compatible ?
C:\Windows\System32>flutter doctor
Doctor summary (to see all details, run flutter doctor -v):
[√] Flutter (Channel stable, 2.8.1, on Microsoft Windows [Version 10.0.19042.1466], locale en-IN)
[√] Android toolchain - develop for Android devices (Android SDK version 32.1.0-rc1)
[√] Chrome - develop for the web
[√] Android Studio (version 2020.3)
[√] VS Code, 64-bit edition (version 1.63.2)
[√] Connected device (2 available)
• No issues found!
C:\Windows\System32>flutter doctor -v
[√] Flutter (Channel stable, 2.8.1, on Microsoft Windows [Version 10.0.19042.1466], locale en-IN)
• Flutter version 2.8.1 at C:\Users\User\Flutter
• Upstream repository https://github.com/flutter/flutter.git
• Framework revision 77d935af4d (8 weeks ago), 2021-12-16 08:37:33 -0800
• Engine revision 890a5fca2e
• Dart version 2.15.1
[√] Android toolchain - develop for Android devices (Android SDK version 32.1.0-rc1)
• Android SDK at C:\Program Files\Android\Sdk
• Platform android-32, build-tools 32.1.0-rc1
• Java binary at: C:\Program Files\Android\Android Studio\jre\bin\java
• Java version OpenJDK Runtime Environment (build 11.0.10+0-b96-7249189)
• All Android licenses accepted.
[√] Chrome - develop for the web
• Chrome at C:\Program Files\Google\Chrome\Application\chrome.exe
[√] Android Studio (version 2020.3)
• Android Studio at C:\Program Files\Android\Android Studio
• Flutter plugin can be installed from:
https://plugins.jetbrains.com/plugin/9212-flutter
• Dart plugin can be installed from:
https://plugins.jetbrains.com/plugin/6351-dart
• Java version OpenJDK Runtime Environment (build 11.0.10+0-b96-7249189)
[√] VS Code, 64-bit edition (version 1.63.2)
• VS Code at C:\Program Files\Microsoft VS Code
• Flutter extension version 3.34.0
[√] Connected device (2 available)
• Chrome (web) • chrome • web-javascript • Google Chrome 98.0.4758.82
• Edge (web) • edge • web-javascript • Microsoft Edge 98.0.1108.43
• No issues found!
And also, can anyone explain me what is flutter channel and when and how to use it ?

Possible to Hot Reload With flutter run Command?

I'm currently making an app for Android with Flutter, and I'm using google-mobile-ads package to show banner ads.
My environment is VScode & Android emurator by Android Studio.
To run this project Execute this command:
$ flutter run --no-sound-null-safety
Not with Play button.
However if I run with this command, hot reload is disabled. Any edits don't make any changes.
flutter doctor -v;
[√] Flutter (Channel beta, 2.6.0-5.2.pre, on Microsoft Windows [Version 10.0.22000.282], locale ja-JP)
• Flutter version 2.6.0-5.2.pre at D:\src\flutter_windows_2.5.0-stable\flutter
• Upstream repository https://github.com/flutter/flutter.git
• Framework revision 400608f101 (8 weeks ago), 2021-09-15 15:50:26 -0700
• Engine revision 1d521d89d8
• Dart version 2.15.0 (build 2.15.0-82.2.beta)
[√] Android toolchain - develop for Android devices (Android SDK version 29.0.3)
• Android SDK at D:\Android
• Platform android-30, build-tools 29.0.3
• Java binary at: D:\Program Files\Android\Android Studio\jre\bin\java
• Java version OpenJDK Runtime Environment (build 11.0.8+10-b944.6842174)
• All Android licenses accepted.
[√] Chrome - develop for the web
• Chrome at C:\Program Files\Google\Chrome\Application\chrome.exe
[√] Android Studio (version 4.2)
• Android Studio at D:\Program Files\Android\Android Studio
• Flutter plugin can be installed from:
https://plugins.jetbrains.com/plugin/9212-flutter
• Dart plugin can be installed from:
https://plugins.jetbrains.com/plugin/6351-dart
• Java version OpenJDK Runtime Environment (build 11.0.8+10-b944.6842174)
[√] VS Code (version 1.62.0)
• VS Code at C:\Users\yukik\AppData\Local\Programs\Microsoft VS Code
• Flutter extension version 3.28.0
[√] Connected device (3 available)
• Android SDK built for x86 (mobile) • emulator-5554 • android-x86 • Android 10 (API 29) (emulator)
• Chrome (web) • chrome • web-javascript • Google Chrome 95.0.4638.69
• Edge (web) • edge • web-javascript • Microsoft Edge 95.0.1020.44
• No issues found!
How can I make this possible?
When using flutter run you should be able to hot reload pressing r and to hot restart using R. Just press them in the terminal where you've used flutter run.
If I remember correctly, launching flutter run you should get all these info on the console as a message when starting!

App runs well in Chrome but not in Android

I have developed a flutter app that runs well in Chrome (Web-based) but when I try to run on Android phone it gives me the following error:
* What went wrong:
Execution failed for task ':firebase_core:compileDebugJavaWithJavac'.
> java.lang.NullPointerException (no error message)
Will be grateful if someone can send me solution.
D:\flutterapps\etea>flutter doctor -v
[√] Flutter (Channel stable, 2.2.3, on Microsoft Windows [Version 10.0.19042.1165], locale en-GB)
• Flutter version 2.2.3 at c:\flutter
• Framework revision f4abaa0735 (8 weeks ago), 2021-07-01 12:46:11 -0700
• Engine revision 241c87ad80
• Dart version 2.13.4
[!] Android toolchain - develop for Android devices (Android SDK version 30.0.3)
• Android SDK at C:\Users\Lenovo\AppData\Local\Android\sdk
• Platform android-30, build-tools 30.0.3
• Java binary at: C:\Program Files\Justinmind\Justinmind 9.2.0\app\jdk\9.2.0\bin\java
• Java version OpenJDK Runtime Environment 18.9 (build 11.0.2+9)
X Android license status unknown.
Run flutter doctor --android-licenses to accept the SDK licenses.
See https://flutter.dev/docs/get-started/install/windows#android-setup for more details.
[√] Chrome - develop for the web
• Chrome at C:\Program Files\Google\Chrome\Application\chrome.exe
[!] Android Studio (version 4.1.0)
• Android Studio at C:\Program Files\Android\Android Studio
• Flutter plugin can be installed from:
https://plugins.jetbrains.com/plugin/9212-flutter
• Dart plugin can be installed from:
https://plugins.jetbrains.com/plugin/6351-dart
X Unable to determine bundled Java version.
• Try updating or re-installing Android Studio.
[√] Connected device (3 available)
• SM A205F (mobile) • R58M739343L • android-arm64 • Android 11 (API 30)
• Chrome (web) • chrome • web-javascript • Google Chrome 92.0.4515.159
• Edge (web) • edge • web-javascript • Microsoft Edge 92.0.902.78
! Doctor found issues in 2 categories.

Categories

Resources