Error connecting to the service protocol: No Flutter view is available - android

As i run flutter project (flutter run) in android studio..
Application is built in device resulting connection loss .. this happens most of the time ..
Running Gradle task 'assembleDebug'...
Running Gradle task 'assembleDebug'... Done 125.8s (!)
√ Built build\app\outputs\flutter-apk\app-debug.apk.
Installing build\app\outputs\flutter-apk\app.apk... 38.7s
Error connecting to the service protocol: No Flutter view is available on Redmi Note 3.
I'm on flutter channel master*
Flutter channels:
* master
dev
beta
stable
flutter doctor -v
[√] Flutter (Channel master, 1.18.0-9.0.pre.73, on Microsoft Windows [Version 10.0.18362.778], locale en-IN)
• Flutter version 1.18.0-9.0.pre.73 at C:\src\flutter
• Framework revision bd6ccb606a (35 hours ago), 2020-04-29 16:31:42 -0700
• Engine revision 2db3276573
• Dart version 2.9.0 (build 2.9.0-4.0.dev 726d3c7725)
[√] Android toolchain - develop for Android devices (Android SDK version 29.0.2)
• Android SDK at C:\Users\ABHIJEET\AppData\Local\Android\Sdk
• Platform android-29, build-tools 29.0.2
• ANDROID_HOME = C:\Users\ABHIJEET\AppData\Local\Android\Sdk
• Java binary at: D:\installs\Android Studio\jre\bin\java
• Java version OpenJDK Runtime Environment (build 1.8.0_212-release-1586-b04)
• All Android licenses accepted.
[√] Chrome - develop for the web
• Chrome at C:\Program Files (x86)\Google\Chrome\Application\chrome.exe
[√] Android Studio (version 3.6)
• Android Studio at D:\installs\Android Studio
• Flutter plugin version 45.1.1
• Dart plugin version 192.7761
• Java version OpenJDK Runtime Environment (build 1.8.0_212-release-1586-b04)
[√] Connected device (3 available)
• Redmi Note 3 • 57abce51 • android-arm64 • Android 6.0.1 (API 23)
• Web Server • web-server • web-javascript • Flutter Tools
• Chrome • chrome • web-javascript • Google Chrome 81.0.4044.129
• No issues found!

Running for Second time resolves the error , but still I don't understand why most of time error occurs resulting connection loss to the device.

Related

FacebookActivity could not be started when I have an activity-alias

I have set the icon change dynamically in my app. Icon switching is set with an activity-alias (as described in the Android documentation). After changing the icon, and then changing the activity, login with Facebook no longer works with error "Log in attempt failed: FacebookActivity could not be started. Please make sure you added FacebookActivity to the AndroidManifest". My AndroidManifest.xml is configured as Facebook's documentation. Do you have any ideas? Thank you.
PS. The code I'm using right now is just a test project but partially replicating what's configured in my main project :)
Change Icon and Facebook login functions
My AndroidManifest.xml
flutter doctor -v
[✓] Flutter (Channel stable, 3.3.8, on macOS 13.0.1 22A400 darwin-x64, locale it-IT)
• Flutter version 3.3.8 on channel stable at /Users/wiwo/fvm/versions/3.3.8
• Upstream repository https://github.com/flutter/flutter.git
• Framework revision 52b3dc25f6 (4 settimane fa), 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 /Users/Wiwo/Library/Android/sdk
• Platform android-33, build-tools 33.0.0
• Java binary at: /Applications/Android Studio.app/Contents/jre/Contents/Home/bin/java
• Java version OpenJDK Runtime Environment (build 11.0.13+0-b1751.21-8125866)
• All Android licenses accepted.
[✓] Xcode - develop for iOS and macOS (Xcode 14.1)
• Xcode at /Applications/Xcode.app/Contents/Developer
• Build 14B47b
• CocoaPods version 1.11.3
[✓] Chrome - develop for the web
• Chrome at /Applications/Google Chrome.app/Contents/MacOS/Google Chrome
[✓] Android Studio (version 2021.3)
• Android Studio at /Applications/Android Studio.app/Contents
• 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)
[✓] IntelliJ IDEA Ultimate Edition (version 2022.2.3)
• IntelliJ at /Applications/IntelliJ IDEA.app
• Flutter plugin version 71.0.5
• Dart plugin version 222.4345.14
[✓] VS Code (version 1.73.1)
• VS Code at /Applications/Visual Studio Code.app/Contents
• Flutter extension version 3.54.0
[✓] Connected device (4 available)
• ONEPLUS A6003 (mobile) • 192.168.178.110:5555 • android-arm64 • Android 11 (API 30)
• iPhone di Silvio (mobile) • 00008101-00126D1821E3003A • ios • iOS 16.2 20C5049e
• macOS (desktop) • macos • darwin-x64 • macOS 13.0.1 22A400 darwin-x64
• Chrome (web) • chrome • web-javascript • Google Chrome 108.0.5359.94
! Error: iPhone di Silvio is busy: Fetching debug symbols for iPhone di Silvio. Xcode will continue when iPhone di Silvio is finished. (code -10)
! Error: Apple Watch di Silvio needs to connect to determine its availability. Check the connection between the device and its companion iPhone, and the connection between the iPhone and Xcode. Both devices may also need to be restarted and unlocked. (code 1)
[✓] HTTP Host Availability
• All required HTTP hosts are available
• No issues found!
I expect the activity to be found even when I am an activity-alias

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.

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!

Mac m1 flutter project not running on Android device or emulator

I using Macbook Air M1. Simple flutter project. Trying to build the app for android device or emulator no mattaer through Android Studio or from terminal flutter return this message:
Launching lib/main.dart on sdk gphone64 arm64 in debug mode...
Running Gradle task 'assembleDebug'...
Exception: The flutter tool cannot access the file or directory.
Please ensure that the SDK and/or project is installed in a location that has read/write permissions for the current user.
Trying chmod 777 for both projet and sdk folders did nothing.
Flutter docor output:
flutter doctor -v
[✓] Flutter (Channel stable, 2.5.3, on macOS 11.6 20G165 darwin-arm, locale
en-IL)
• Flutter version 2.5.3 at /Users/michaelbabozhko/Documents/flutter
• Upstream repository https://github.com/flutter/flutter.git
• Framework revision 18116933e7 (12 days ago), 2021-10-15 10:46:35 -0700
• Engine revision d3ea636dc5
• Dart version 2.14.4
[✓] Android toolchain - develop for Android devices (Android SDK version 31.0.0)
• Android SDK at /Users/michaelbabozhko/Library/Android/sdk
• Platform android-31, build-tools 31.0.0
• Java binary at: /Applications/Android
Studio.app/Contents/jre/Contents/Home/bin/java
• Java version OpenJDK Runtime Environment (build 11.0.10+0-b96-7249189)
• All Android licenses accepted.
[✓] Xcode - develop for iOS and macOS
• Xcode at /Applications/Xcode.app/Contents/Developer
• Xcode 13.0, Build version 13A233
• CocoaPods version 1.11.2
[✓] Chrome - develop for the web
• Chrome at /Applications/Google Chrome.app/Contents/MacOS/Google Chrome
[✓] Android Studio (version 2020.3)
• Android Studio at /Applications/Android Studio.app/Contents
• 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.61.0)
• VS Code at /Applications/Visual Studio Code.app/Contents
• Flutter extension can be installed from:
🔨 https://marketplace.visualstudio.com/items?itemName=Dart-Code.flutter
[✓] Connected device (2 available)
• sdk gphone64 arm64 (mobile) • emulator-5554 • android-arm64 • Android 12
(API 31) (emulator)
• Chrome (web) • chrome • web-javascript • Google
Chrome 94.0.4606.81
• No issues found!
I had same issue on M1 MacBook with Flutter version v2.5.3 and I tried that way and it worked.
Open your project's android folder with Android Studio
Wait for Android Studio when it installs missing plugins and syncs Gradle.
Open your project on VSCode, debug and have fun!
Answered!
Finally I found solution - just reseted android stiudio settings to defaults and downloaded plugins. See screenshot attachedenter image description here.

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