Flutter run Error: No such file or directory - flutter

When I try to run my app. It shows me this error
Using hardware rendering with device AOSP on IA Emulator. If you notice graphics artifacts, consider enabling software rendering with
"--enable-software-rendering".
Launching lib\main.dart on AOSP on IA Emulator in debug mode...
Running Gradle task 'assembleDebug'...
Running Gradle task 'assembleDebug'... Done 14,5s
√ Built build\app\outputs\flutter-apk\app-debug.apk.
Installing build\app\outputs\flutter-apk\app.apk... 26ms
Error: ADB exited with exit code 1
Performing Streamed Install
adb: failed to open C:\Users\...\build\app\outputs\flutter-apk\app.apk:
No such file or directory
Error launching application on AOSP on IA Emulator.
I try it also with a physical device but I get still the same error.
I have tried many things.
Wipe Data
Cool boot
Create new Emulator
But non of them worked for me.
Flutter doctor:
Doctor summary (to see all details, run flutter doctor -v):
[√] Flutter (Channel stable, 2.2.3, on Microsoft Windows [Version 10.0.19042.1052], locale de-DE)
[√] Android toolchain - develop for Android devices (Android SDK version 30.0.1)
[√] Chrome - develop for the web
[√] Android Studio
[√] VS Code (version 1.58.0)
[√] Connected device (3 available)
• No issues found!
I am happy for any help!

Did you try to enable software rendering?
flutter run --enable-software-rendering

Honestly if I were you, I'd just re-make a new app with flutter create ...
and then transfer all of the files from your old proj. - I know it's a pain to redo the pubspec.yalm but it's what I would do

found a fix, simply move the file(app.so) from
\build\windows\runner\Debug\app.so;
to build\windows\runner\Debug\data\app.so
in most case you have to locate the app.so, i cannot define the structure of your project, but once you find the app.so file simply move it into the \build\windows\runner\debug\data folder

Related

Flutter 2: Error connecting to the service protocol: failed to connect to http://127.0.0.1:1039/ #58588

I'm experiencing an issue with the Flutter template app when launching it on Flutter 2.0.3.
I'm getting this output
Launching lib/main.dart on SM J320H in debug mode...
Running Gradle task 'assembleDebug'...
✓ Built build/app/outputs/flutter-apk/app-debug.apk.
Installing build/app/outputs/flutter-apk/app.apk...
Error connecting to the service protocol: failed to connect to http://127.0.0.1:62719/OJaWBfEtnmY=/
I'm launching this app on a real Android device.
When launching with Flutter 1.22.5 - everything works fine.
Flutter doctor output:
Doctor summary (to see all details, run flutter doctor -v):
[✓] Flutter (Channel stable, 2.0.3, on Mac OS X 10.15.7 19H2 darwin-x64, locale
en-UA)
[✓] Android toolchain - develop for Android devices (Android SDK version 30.0.3)
[✓] Xcode - develop for iOS and macOS
[✓] Chrome - develop for the web
[✓] Android Studio (version 4.1)
[✓] IntelliJ IDEA Ultimate Edition (version 2020.1.1)
[✓] VS Code (version 1.54.3)
[✓] Connected device (2 available)
• No issues found!
I just got the same problem.
It's because of your dart and flutter versions I guess.
Just run flutter upgrade and flutter clean to solve the problem.
Similar problem solutions here: https://github.com/flutter/flutter/issues/47204
This helped me. Here is the log:
PS D:\Documents\Work\bus_stop_routes> flutter clean
Deleting build... 629ms
Deleting .dart_tool... 567ms
Deleting .packages... 0ms
Deleting Generated.xcconfig... 0ms
Deleting flutter_export_environment.sh... 0ms
Deleting .flutter-plugins-dependencies... 0ms
Deleting .flutter-plugins... 0ms
PS D:\Documents\Work\bus_stop_routes> flutter pub get
Running "flutter pub get" in bus_stop_routes... 3.4s
PS D:\Documents\Work\bus_stop_routes> flutter run
Launching lib\main.dart on SM N910H in debug mode...
Note: C:\flutter\.pub-cache\hosted\pub.dartlang.org\google_maps_flutter-2.0.1\android\src\main\java\io\flutter\plugins\googlemaps\Convert.java uses or overrides a deprecated API.
Running Gradle task 'assembleDebug'...
Running Gradle task 'assembleDebug'... Done 46.3s
√ Built build\app\outputs\flutter-apk\app-debug.apk.
Installing build\app\outputs\flutter-apk\app.apk... 29.0s
Activating Dart DevTools... 3.1s
Error connecting to the service protocol: failed to connect to http://127.0.0.1:58851/a7SAG7gM8aI=/
PS D:\Documents\Work\bus_stop_routes> dart upgrade
Could not find a command named "upgrade".
Usage: dart [<vm-flags>] <command|dart-file> [<arguments>]
Global options:
-h, --help Print this usage information.
-v, --verbose Show additional command output.
--version Print the Dart SDK version.
--enable-analytics Enable anonymous analytics.
--disable-analytics Disable anonymous analytics.
Available commands:
analyze Analyze the projects Dart code.
compile Compile Dart to various formats.
create Create a new project.
fix Apply automated fixes to Dart source code.
format Idiomatically format Dart source code.
migrate Perform a null safety migration on a project or package.
pub Work with packages.
run Run a Dart program.
test Run tests in this package.
Run "dart help <command>" for more information about a command.
See https://dart.dev/tools/dart-tool for detailed documentation.
PS D:\Documents\Work\bus_stop_routes> flutter upgrade
Upgrading Flutter to 2.0.4 from 2.0.3 in C:\flutter...
Checking Dart SDK version...
Downloading Dart SDK from Flutter engine 2dce47073a378673f6ca095e91b8065544c3a881...
Building flutter tool...
Running pub upgrade...
Upgrading engine...
Downloading android-arm-profile/windows-x64 tools... 20.1s
Downloading android-arm-release/windows-x64 tools... 8.7s
Downloading android-arm64-profile/windows-x64 tools... 9.7s
Downloading android-arm64-release/windows-x64 tools... 8.2s
Downloading android-x64-profile/windows-x64 tools... 9.3s
Downloading android-x64-release/windows-x64 tools... 7.9s
Downloading android-x86 tools... 98.3s
Downloading android-x64 tools... 64.8s
Downloading android-arm tools... 15.6s
Downloading android-arm-release tools... 12.4s
Downloading android-arm64 tools... 36.2s
Downloading android-arm64-profile tools... 18.1s
Downloading android-arm64-release tools... 14.6s
Downloading android-x64-profile tools... 19.0s
Downloading android-x64-release tools... 15.0s
Downloading android-x86-jit-release tools... 21.6s
Downloading Web SDK... 42.0s
Flutter 2.0.4 • channel stable • https://github.com/flutter/flutter.git
Framework • revision b1395592de (7 days ago) • 2021-04-01 14:25:01 -0700
Engine • revision 2dce47073a
Tools • Dart 2.12.2
Running flutter doctor...
Doctor summary (to see all details, run flutter doctor -v):
[√] Flutter (Channel stable, 2.0.4, on Microsoft Windows [Version 10.0.19042.867], locale en-US)
[√] Android toolchain - develop for Android devices (Android SDK version 30.0.3)
[√] Chrome - develop for the web
[√] Android Studio (version 4.1.0)
[√] VS Code (version 1.55.0)
[√] Connected device (3 available)
• No issues found!
PS D:\Documents\Work\bus_stop_routes> flutter run
Running "flutter pub get" in bus_stop_routes... 1,114ms
Launching lib\main.dart on SM N910H in debug mode...
Running Gradle task 'assembleDebug'...
Running Gradle task 'assembleDebug'... Done 107.2s
√ Built build\app\outputs\flutter-apk\app-debug.apk.
Installing build\app\outputs\flutter-apk\app.apk... 29.2s
Syncing files to device SM N910H... 141ms
Flutter run key commands.
r Hot reload.
R Hot restart.
h Repeat this help message.
d Detach (terminate "flutter run" but leave application running).
c Clear the screen
q Quit (terminate the application on the device).
An Observatory debugger and profiler on SM N910H is available at:
http://127.0.0.1:60828/axOQuzsu83M=/
If not solved, it's about the extension that you using.
Please reopen your editor after this. But sometimes that not working when you use extensions.
I also checked the virus defender. And allowed the permission.
I experience this issue when I add certain plugins or when I open the project in both Visual Studio Code and Android Studio.
If all other attempts to resolve this issue fails, restart your test device. This has worked for me.
restart your device will work perfectly
To solve it, use an android emulator with API 28(Android 9)...
Try it and tell me if solved your problem or not...

Flutter2 - Can't find service: package (Android Studio -Windows10)

On upgrading a working project to Flutter_2 and running it , gives the error below.
As per answer to similar question ,Avd Data(Pixel_3a) has been wiped.
How to resolve this ?
ERROR
Can't find service: package / Can't find service: activity
FULL ERROR
Launching lib\forms\validateForm1.dart on sdk gphone x86 arm in debug mode...
Running Gradle task 'assembleDebug'...
√ Built build\app\outputs\flutter-apk\app-debug.apk.
cmd: Can't find service: activity
Installing build\app\outputs\flutter-apk\app.apk...
Error: ADB exited with exit code 1
Performing Streamed Install
adb: failed to install F:\Script\Flutter\myapp\build\app\outputs\flutter-apk\app.apk: cmd: Can't find service: package
Error launching application on sdk gphone x86 arm.
Flutter Doctor
Doctor summary (to see all details, run flutter doctor -v):
[√] Flutter (Channel dev, 2.1.0-10.0.pre, on Microsoft Windows [Version 10.0.18363.1379], locale en-US)
[√] Android toolchain - develop for Android devices (Android SDK version 30.0.3)
[X] Chrome - develop for the web (Cannot find Chrome executable at .\Google\Chrome\Application\chrome.exe)
! Cannot find Chrome. Try setting CHROME_EXECUTABLE to a Chrome executable.
[√] Visual Studio - develop for Windows (Visual Studio Community 2019 16.8.3)
[√] Android Studio (version 4.1.0)
[√] VS Code (version 1.54.1)
[√] Connected device (2 available)
Deleting Avd related lock files resolved the issue.
Open Avd Manager -> ShowonDisk -> Delete following 2 lock files from disk --->
hardware-qemu & multiinstance.lock

Flutter error while adding web support to app

I just found out that I can change my flutter app to a website without writing external code. I decided to test it on my app but I got this error and I have no idea how to fix it. I followed the steps on the "website" but still I get the error. My stacktrace is :-
This application is not configured to build on the web.
To add web support to a project, run `flutter create .`.
Launching lib\main.dart on Web Server in debug mode...
Syncing files to device Web Server...
org-dartlang-app:/web_entrypoint.dart:8:8: Error: Error when reading 'lib/generated_plugin_registrant.dart': The system cannot find the file specified.
import 'package:discountapp/generated_plugin_registrant.dart';
^
org-dartlang-app:/web_entrypoint.dart:11:3: Error: Method not found: 'registerPlugins'.
registerPlugins(webPluginRegistry);
^^^^^^^^^^^^^^^
Failed to compile application.
I run flutter create . and it says
C:\Users\Hemant\AndroidStudioProjects\discountapp\ios>flutter create .
Recreating project ....
Wrote 3 files.
All done!
[√] Flutter: is fully installed. (Channel beta, 1.20.0-7.2.pre, on Microsoft Windows [Version 10.0.18363.959], locale en-US)
[√] Android toolchain - develop for Android devices: is fully installed. (Android SDK version 29.0.3)
[√] Chrome - develop for the web: is fully installed.
[√] Android Studio: is fully installed. (version 4.0)
[√] Connected device: is fully installed. (3 available)
In order to run your application, type:
$ cd .
$ flutter run
Your application code is in .\lib\main.dart.
C:\Users\Hemant\AndroidStudioProjects\discountapp\ios>flutter create .
Recreating project ....
Wrote 3 files.
All done!
[√] Flutter: is fully installed. (Channel beta, 1.20.0-7.2.pre, on Microsoft Windows [Version 10.0.18363.959], locale en-US)
[√] Android toolchain - develop for Android devices: is fully installed. (Android SDK version 29.0.3)
[√] Chrome - develop for the web: is fully installed.
[√] Android Studio: is fully installed. (version 4.0)
[√] Connected device: is fully installed. (3 available)
In order to run your application, type:
$ cd .
$ flutter run
Your application code is in .\lib\main.dart.
Running flutter run will run it on my phone. I will provide any code needed. Please help
You have to run flutter create . in application's root folder, but not in ios subfolder.
Rename ios folder to _ios
Run this command in your Terminal: flutter create --platforms=web .
Rename back _ios folder to ios
This will write all needed files to run your app on the browser.

Error connecting to the service protocol: Exception: Attempted to connect to Dart observatory 5 times, and all attempts failed. Giving up. The URL was

My app starts but then stops because of the error. I am using Windows 10, android studio as an IDE, and trying to build an android app.
if I use a terminal outside of Android studio it works, so it should be android studio related.
console:
Launching lib\main.dart on Android SDK built for x86 in debug mode...
Initializing gradle...
Resolving dependencies...
Gradle task 'assembleDebug'...
Built build\app\outputs\apk\debug\app-debug.apk.
Installing build\app\outputs\apk\app.apk...
Error connecting to the service protocol: Exception: Attempted to connect to
Dart observatory 5 times, and all attempts failed. Giving up. The URL was
ws://127.0.0.1:50997/ws
flutter Doctor:
Doctor summary (to see all details, run flutter doctor -v):
[√] Flutter (Channel stable, v1.0.0, on Microsoft Windows [Version
10.0.16299.847], locale de-DE)
[!] Android toolchain - develop for Android devices (Android SDK 28.0.3)
X Android license status unknown.
[√] Android Studio (version 3.2)
[√] Connected device (1 available)
! Doctor found issues in 1 category.
If you have configured a proxy,
ensure you have also set the environment variable
NO_PROXY=127.0.0.1

Flutter Hello world app can't start on Android Emulator x86_64

I am currently working on Xamarin Forms and want to try Flutter.
I created a Flutter project with Android Studio. But I can't run it.
I get this error on Android Emulator
Error launching the application on Android SDK built for x86 64.
flutter doctor looks fine.
some example app like Flutter Gallery can work but some can't.
The platform is Windows 10 64 bit.
Android Studio 3.2.1
Error Message is:
Launching lib\main.dart on Android SDK built for x86 64 in debug
mode... Initializing gradle... Resolving dependencies...
Gradle task 'assembleDebug'... Built
build\app\outputs\apk\debug\app-debug.apk. Installing
build\app\outputs\apk\app.apk... Error: ADB exited with exit code
1 adb: failed to install
C:\Users\xxx\source\flutter\flutter_app\build\app\outputs\apk\app.apk:
Error launching application on Android SDK built for x86 64.
C:\flutter>flutter doctor Doctor summary (to see all details, run
flutter doctor -v): [√] Flutter (Channel stable, v1.0.0, on
Microsoft Windows [Version 10.0.17134.472], locale zh-TW) [√]
Android toolchain - develop for Android devices (Android SDK
28.0.3) [√] Android Studio (version 3.2) [√] IntelliJ IDEA Community Edition (version 2018.3) [!] VS Code, 64-bit edition
(version 1.30.1) [!] Connected device
! No devices available
! Doctor found issues in 2 categories.
As you can see from those lines:
X Flutter plugin not installed; this adds Flutter specific functionality.
X Dart plugin not installed; this adds Dart specific functionality.
You are missing the plugin for flutter and dart.
Go to:
File -> Settings -> Plugins
and install Flutter
And check to see if dart was installed as well