Error: ADB exited with exit code 1 - remedy? - flutter

I am trying to debug a demo app of flutter in vscode where the error is showing for ADB exit with code 1
performing streamed install. I uninstall the existing Flutter demo app.

You should try with these three stuff:
Check out if your emulator memory full.
Check your package name is alright
Clean your flutter and re-run
flutter clean
flutter run

as APK built is Successful there is no issue with the code.
there is something wrong with the device
check u enabled USB debugging
check u enabled install over USB in developer option
few devices don't have to enable install over USB.
then
flutter clean && flutter pub get
uninstall the app in the device and run
flutter run -d <device name>
emphasized text

Related

Launch emulator from windows command line receive error G67247B7E

Newbee here. Trying to run the android emulator for the generic first_app flutter application.
Run flutter run -d windows
Receive:
C:\Development\Flutter\first_app>flutter run -d windows
Launching lib\main.dart on Windows in debug mode...
lib/main.dart(60,15): error G67247B7E: Expected ';' after this. [C:\Development\Flutter\first_app\build\windows\flutter\flutter_assemble.vcxproj]
C:\Program Files\Microsoft Visual Studio\2022\Community\MSBuild\Microsoft\VC\v170\Microsoft.CppCommon.targets(247,5): error MSB8066: Custom build for 'C:\Development\Flutter\first_app\build\windows\CMakeFiles\13756e3632117b79f6e0bc292bc438e0\flutter_windows.dll.rule;C:\Development\Flutter\first_app\build\windows\CMakeFiles\f154f6c681490929a1ff6491e40cd6b3\flutter_assemble.rule' exited with code 1. [C:\Development\Flutter\first_app\build\windows\flutter\flutter_assemble.vcxproj]
Building Windows application...
Exception: Build process failed.
Other information:
Flutter Doctor is clean. That took hours.
Running from Android Studio works.
Launching emulator works correctly
Have tried Flutter Clean, Flutter upgrade, Flutter Master.
Have tried running from powershell with the same error.
Any assistance welcomed.
First you can check if the emulator is running or not by this command
flutter devices
Then you can directly run your app through
flutter run -d device-id
In my case, it was
flutter run -d emulator-5554
All, on a whim, I deleted my first_app and created it again via flutter create first_app.
Immediately running flutter run, it works!

flutter stuck on Compiling, linking and signing

Flutter project is stuck in Compiling, linking and signing... i dont just understand why this is stuck here...
even using verbose i dont get any stack trace on why this is stuck...
Launching lib/main.dart on iPhone 13 Pro Max in debug mode...
Running pod install... 11.6s
Running Xcode build...
└─Compiling, linking and signing...
The problem should be in the existing project created on previous environment (old versions) and has to be resolved by creating a new one and moving content in.
Move all my custom contents from existing my project (assets, fonts, lib folders and config files...) to this new project and ran the command : the flutter build ios command works well now !
following this : Fixing Xcode 9 issue: "iPhone is busy: Preparing debugger support for iPhone"
I TRIED :
On Xcode:
Go to "Window" -> "Devices and Simulators"
"Unpair iPhone" (on the side list, right clic)
Then:
Unplug and plug again the USB cable
Press Trust in the prompt message in the device
in Flutter Terminal, paste and enter :
flutter clean
flutter pub get
cd ios
pod install --repo-update
cd ..
Then run the app.
==> Worked only 1st time for me.
My work around for launching IOS devices for now:
Each time I want IOS device,
I COPY/ PASTE and press ENTER on the Terminal:
flutter clean
flutter pub get
cd ios
pod install --repo-update
cd ..
flutter run

I get an error when I try to run the emulator. Is it a problem with the version? [duplicate]

I'm receiving the following error while running flutter run on some projects, however, on other projects it works fine:
(base) Nusraths-MacBook-Pro:flutter_uber_clone rahama$ flutter emulators --launch Pixel_2_XL_API_28
(base) Nusraths-MacBook-Pro:flutter_uber_clone rahama$ flutter run
Using hardware rendering with device Android SDK built for x86. If you get graphics artifacts, consider enabling software rendering with "--enable-software-rendering".
Launching lib/main.dart on Android SDK built for x86 in debug mode...
Initializing Gradle... 0.8s
Resolving dependencies... 1.4s
Running Gradle task 'assembly debug'...
Running Gradle task 'assembly debug'... Done 9.3s
Built build/app/outputs/apk/debug/app-debug.apk.
Installing build/app/outputs/apk/app.apk... 1.9s
Error: ADB exited with exit code 1
Performing Streamed Install
ADB: failed to install /Users/rahama/development/flutter_uber_clone/build/app/outputs/apk/app.apk: Failure [INSTALL_FAILED_INSUFFICIENT_STORAGE]
Error launching the application on Android SDK built for x86.
It's just the flutter demo project, I haven't made any changes to it.
Actually, the answer lies in the error message of your question:
[ADB: failed to install /Users/rahama/development/flutter_uber_clone/build/app/outputs/apk/app.apk: Failure [INSTALL_FAILED_INSUFFICIENT_STORAGE]Error launching the application on Android SDK built for x86.]
Your Emulator is running out of space, clear its cache:
Click on AVD Manager
Wipe Data (Your Target Device )
You are set to go..
Flutter had a new update (I think last night), run flutter upgrade in the terminal and it should work fine (at least that did it for me).
Docs:
To update both the Flutter SDK and the packages that your app depends on, use the flutter upgrade command from the root of your app (the same directory that contains the pubspec.yaml file)
https://flutter.dev/docs/development/tools/sdk/upgrading
Run in terminal
$ flutter clean
and then
$ flutter pub get
and then
$ flutter packages get
then
$ flutter run
Although I don't have any other apps installed on my emulator, when I install the flutter app, I get the same error.
I found that the storage space of the emulator is indeed not enough. Because when I created the emulator, the default was only 1024M. When I changed the storage space of the emulator to 4096M, the problem was solved.
In my case, it was caused by an adb glitch, not a flutter problem.
This was solved by doing a combination of the following, not sure which step fixed it exactly
Reset adb server on desktop, macOS in mycase: adb kill-server, and then adb start-server
Reset USB debugging on the mobile device.
Restarted the device.
None of the existing answers worked for me, so it wasn't a flutter problem. A plain adb install any.apk didn't work. So I narrowed it down to an adb/usb issue.
this common problem with the Emulator and all you need to clear the Emulator cache .
in my case it was the solution...
1- open AVD Manger.
2- click on the (bottom arrow) that beside (Edit) button.
3- choose Wipe Data.
Sometimes it can work by uninstalling your app and and all it's data then try again,
another fix is to send the apk you are trying to install from projectname/build/app/outputs/apk and to your device and install it and try again.
Note: Following is answer for stuck at Performing Streamed Install by adb install xxx.apk:
phenomenon
use adb install xxx.apk and showing Performing Streamed Install but stuck, hang forever.
Have tried
re-plug USB cable
change USB adapter
change USB cable
reboot PC(Mac)
reboot android phone
restart VSCode
make adb command shorter
from: adb -s hxxxxxxxxs install -r /Users/limao/dev/xxx/crawler/appAutoCrawler/AppCrawler/task/20201202_xxx_0192LeiMoChuanShuo/20201202_xxx_0192LeiMoChuanShuo_gameApp_Android/20201202_xxx_0192LeiMoChuanShuo_gameApp_Android_0.apk
to: adb -s hxxxxxxxxs install -r /var/folders/gt/5868sbcd1jq4rxvryqhy2_1sz8n0s3/T/tmpq3ypjfgd/20201202_xxx_0192LeiMoChuanShuo_gameApp_Android_0.apk
tried adb shell pm install but not support
etc...
all not work.
Final solution
update (original old version 29.0.5) adb to latest version (30.0.5)
Q: how to update adb to latest version
A:
goto
https://developer.android.com/studio/releases/platform-tools
to download your platform adb
下载适用于 Windows 的 SDK Platform-Tools
下载适用于 Mac 的 SDK Platform-Tools
下载适用于 Linux 的 SDK Platform-Tools
or:
goto
https://www.xda-developers.com/google-releases-separate-adb-and-fastboot-binary-downloads/
to download:
windows
https://dl.google.com/android/repository/platform-tools-latest-windows.zip
Mac
https://dl.google.com/android/repository/platform-tools-latest-darwin.zip
Linux
https://dl.google.com/android/repository/platform-tools-latest-linux.zip
unzip to got folder platform-tools
add the folder to your PATH variable
eg:
vi ~/.zshrc
PATH=/Users/limao/dev/tools/android/adb/platform-tools:$PATH
In my case, this was resolved by updating android studio and all the flutter and dart plugins.
Go to File>> invalidate caches
By this way I resolved this issues on BlueStack.Do these steps for running android applications on BlueStack Emulator.
Go to setting of BlueStack Emulator
Then click on Advance and then
Turn on Android Debug Bridge (ADB)
I experienced this same problem on a physical device, tried all solution i could see out there but none worked.
What worked at the end of the day was to ensure my device API version was also installed in the android studio.
image1
image2
Forewords
This question gets the first result from Google, so my answer covers a bit different error.
The error in question has [INSTALL_FAILED_INSUFFICIENT_STORAGE] code. My answer is for any Performing Streamed Install error that does not specifically define [INSTALL_FAILED_INSUFFICIENT_STORAGE] code.
My Environment
KDE Neon 5.24 (a.k.a. Ubuntu 20.04 but latest KDE stuff)
Visual Studio Code from Snap (I use this mainly)
Android Studio from Snap (I use this to install SDK, Platform Tools and Build Tools)
Troubleshooting
The problem is this globally installed /usr/bin/adb overrides the adb that Flutter uses. As you know, Ubuntu has many outdated packages (to protect their system's stability). ADB is one of them. So, if you try to do:
adb kill-server
adb start-server
You will highly likely get an output similar to below:
* daemon not running; starting now at tcp:5037
ADB server didn't ACK
Full server startup log: /tmp/adb.1000.log
Server had pid: 12668
--- adb starting (pid 12668) ---
adb I 03-26 03:19:35 12668 12668 main.cpp:57] Android Debug Bridge version 1.0.39
adb I 03-26 03:19:35 12668 12668 main.cpp:57] Version 1:8.1.0+r23-5ubuntu2
adb I 03-26 03:19:35 12668 12668 main.cpp:57] Installed as /usr/lib/android-sdk/platform-tools/adb
adb I 03-26 03:19:35 12668 12668 main.cpp:57]
adb I 03-26 03:19:35 12668 12668 adb_auth_host.cpp:416] adb_auth_init...
adb I 03-26 03:19:35 12668 12668 adb_auth_host.cpp:174] read_key_file '/home/erayerdin/.android/adbkey'...
adb I 03-26 03:19:35 12668 12668 adb_auth_host.cpp:391] adb_auth_inotify_init...
adb I 03-26 03:19:35 12668 12668 adb_auth_host.cpp:467] Calling send_auth_response
adb server killed by remote request
* failed to start daemon
error: cannot connect to daemon
In some flutter run sessions, I've got an output similar to "adb server version (whatever) does not match the client (whatever); killing". That's when I had the doubt maybe I have installed adb globally. Check this:
which adb
# /usr/bin/adb
# This is a sign that this adb might be globally installed.
# This must be a symlink. Just to make sure, I do the following...
realpath /usr/bin/adb
# /usr/lib/android-sdk/platform-tools
# This is the evidence that it has been installed globally.
So, we use an outdated version of adb, which does not match the target device's adb server.
Solution
So, we need to get rid of this global adb first.
⚠ Warning
If you use adb from terminal, what we are going to do will remove it. You can add your {SDK PATH}/platform-tools where SDK PATH is where you have installed SDK to get it back.
Simply do:
sudo apt remove android-sdk android-sdk-common android-sdk-build-tools android-sdk-build-tools-common android-sdk-platform-tools android-sdk-platform-tools-common
However, doing these actually does not remove adb from the system. It still lays there for some reason, so, for the last step, we do:
# simply backup our symlink
sudo mv /usr/bin/adb /usr/bin/adb.bak
# and backup global android-sdk tools
sudo mv /usr/lib/android-sdk /usr/lib/android-sdk.bak
After these steps, you can restart your editor and try again. If you want to make double sure, you can optionally do (while your editor's closed):
# clean the build artifacts
flutter clean
# reinstall the packages because we have cleared them
flutter pub get
flutter pub get packages
Android 12 requires you to add a piece of code to your main activity
Go to your project folder and open the AndroidManifest.xml file
Add the below code in the activity
android:exported="true"
I was having the same issue with a physical device connected via wifi, then I figured out what was wrong. The battery of my device was below 15%, it worked as expected after charging. So, keep an eye on the battery status if you're working with a physical device via wifi.

Flutter crash on release apk installed on devices / Emulator

Could you guys please help me with the problems I currently have?
I'm trying to follow the steps of how to release apk android from: https://flutter.dev/docs/deployment/android, The program which I tried to release is only the NewFlutterApplication which created from template of Flutter
The problem is: Have been followed all the steps, still I can't run the release apk which i build from flutter
The Error which I got:
Error: ADB exited with exit code 1
Performing Streamed Install
adb: failed to install E:\FlutterProject\flutter_app_1\build\app\outputs\apk\app.apk: Failure [INSTALL_FAILED_NO_MATCHING_ABIS: Failed to extract native libraries, res=-113]
Install failed
The things that I have tried:
Tried from this site Flutter release apk is not installing on device, but there is no hope
Tried from this site Can't build release APK for flutter, but still no hope
Tried using the flutter run --release in the real device, it's directly crash and return stopped working
Tried using the flutter build apk && flutter install, it's not running and give the error from top error
Tried using flutter run -v it don't give any error and run smoothly and the debug it's still run smoothly, only the release APK is the problem which can't be run
UPD: This answer is outdated, Flutter now supports x86/x64
You can't run release build on emulator, because currently flutter doesn't support x86 release binaries
See this issue, and put thumb up reaction on it to increase priority:
https://github.com/flutter/flutter/issues/9253
This issue also affects devices that use Intel Atom and some Chromebooks, but don't worry, they will be excluded from supported devices by Google Play automatically
INSTALL_FAILED_NO_MATCHING_ABIS is when you are trying to install an app that has native libraries and it doesn't have a native library for your cpu architecture. For example if you compiled an app for armv7 and are trying to install it on an emulator that uses the Intel architecture instead it will not work.

how to build apk create old version app in Flutter

I am trying to build my release app in Flutter and when I run:
flutter run
everything works fine in debugging and test mode. But when I was trying to build a release app with:
flutter build apk
it creates an old first-release app of mine. That I created before and I try to reset the computer reset android and everything but not work what can I do to reset it and clear the cache?
I'm trying almost to delete and reset everything but they don't work.
What command that I have to run to fix it and create new version release apk
The solution is easy.
Just run flutter clean and run flutter build apk after that and it generates the updated app apk.
If you want to install it directly just run flutter install after the build command.
To all the beginners If you wish to release an apk of a flutter app just do:
flutter run --release
(and make sure to connect your device to a phone)
steps to ensure your phone is connected:
1. enable usb debugging mode in your phone
2.click on version number of your phone in system settings to enter into developer mode
3. change the phone mode to transferring file mode
After you run the command
go to build->apps->output->apk
run these command
flutter clean
and after that
flutter build apk --release
Run this command for making a bundle.
flutter build appbundle --target-platform android-arm,android-arm64,android-x64
If flutter clean and flutter build apk also generates apk with old version code in your pubspec.yaml change the version like this version: 1.0.2+2
Before + it is your version name and after + sign it is your version code
NOTE: Your new version number should be in the place of 2. Or you can use different format such as 1.2+2
You can run flutter clean Then run flutter build apk --split-per-abi to split the apk. It will build three apks and you can find them in build/app/outputs/flutter-apk/
Can be done easily by Android Studio