stuck at Preparing "Install Android Emulator (revision: 31.2.10)" - android-emulator

while installing the android emulator mine was stuck at
os Linux: manjaro
Preparing "Install Android Emulator (revision: 31.2.10)".
Downloading https://dl.google.com/android/repository/emulator-linux_x64-8420304.zip

+1
Preparing "Install Android Emulator (revision: 31.3.10)".
Downloading https://dl.google.com/android/repository/emulator-darwin_aarch64-8807927.zip
Warning: This download could not be finalized from the interim state. Retrying without caching.
Downloading https://dl.google.com/android/repository/emulator-darwin_aarch64-8807927.zip

cancel the download process and run it again it worked for me but don't know whats the problem tho

In my case I only need to wait a little ... Maybe the download take some time, but after 10 minutes the installer works just fine ... (just wait a few minutes... )

Related

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 app could not locate aapt while building

When I was trying to build and run a flutter app it shows me the following message:
"Could not locate aapt. Please ensure you have the Android buildtools installed.
Exception: Problem building Android application: see above error(s)."
I already have both build tools and the android sdk installed, so I don't know what might have caused this issue.
Going into the folder where the android sdk is located and under the 'build-tools' delete everything inside it, then using android studio re install the build tools this will fix the issue
check in cmd flutter doctor
something like this will occur
[!] Android toolchain - develop for Android devices (Android SDK version 30.0.3)
X Android SDK file not found: C:\Users\aksha\AppData\Local\Android\sdk\build-tools\30.0.3\aapt.
problem is your sdk version 30.0.3 is not installed successfully
try to download it seperatelly from
https://androidsdkoffline.blogspot.com/p/android-sdk-build-tools.html?m=1
and unzip it and replace its contant with 30.0.3 at location C:\Users\aksha\AppData\Local\Android\sdk\build-tools\30.0.3
restart
done
For me the issue was resolved by running flutter doctor in cmd. The issue was accepting licenses. Running flutter doctor --android-licenses and then typing y for all licenses resolved the issue.
You can use this command flutter config --android-sdk after updating the android studio and can refer to the path from SDK manager
I was able to generate apk but I was also unable to install the apk in device I removed the error by following steps-
go to C:\Users\aksha\AppData\Local\Android\sdk\build-tools\30.0.3 (check show hidden items option)
delete this folder inside build-tools (because the error is not installed properly).
for resolving this issue, we have to uncheck all the latest plateforms (android (S)12 etc) and click apply after this restart the studio and check all these platforms again at least one latest and apply(ok).
Open Android Studio->files->Settings->Appearence & Behavior->System
Settings->Android SDK->SDK plateforms(Latest)
run flutter command to accept the licenses. (type Y then enter for all)
flutter doctor --android-licenses
all is done
It will be an Android Studio bug.
I updated Android Studio to the latest Beta version and fixed it.
I hope it will be of help to you too.
If you are using ubuntu check /home/username/Android/Sdk folder present or not, I think your sdk folder deleted or moved to new location. thats why this issue happen.
You must update your build tools of SDK by using SDK manager in android studio.
go to androidstudio->sdkmanager->sdktools->then update build tools
Delete uncompleted downloads in the "C:\Users\User\AppData\Local\Android\Sdk.downloadIntermediates" folder and reinstall the SDK build tools via the Android Studio's SDK manager.

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.

After uninstall app on device flutter run not work

I'm using vs code for building my flutter app.
But after uninstall debug app on my device, 'flutter run' command not working properly and stop in installing status.
Please help me.
Thanks.
Launching lib/main.dart on RNE L21 in debug mode...
Initializing gradle... ۱۱٫۷s
Resolving dependencies... ۱۴٫۹s
Gradle task 'assembleDebug'...
Gradle task 'assembleDebug'... Done ۱۰۱٫۷s
Built build\app\outputs\apk\debug\app-debug.apk.
Installing build\app\outputs\apk\app.apk... ۶٫۱s
It seems like when you uninstall the flutter application, though it is no longer available on the phone It is not deleted properly(Only in the flutter case). Therefore to fix this. you can run adb and uninstall from the package. Here is a step-by-step procedure.
If you are in windows:
Step 1. Open your SDK path in command prompt
eg.
C:\Users\kharag\AppData\Local\Android\Sdk\platform-tools
Step 2. Search your app package name from the flutter app (It will be in AndroidManifest.xml)
eg.
com.mycodingchannel.icttapp
Step 3. Now uninstall your app by running the command:
adb uninstall com.mycodingchannel.icttapp
That's all, Now run your app and it should work. Thanks
Had the same problem, copied .apk file on device and installed it from there, after that debugger worked without any issues.
Once you see Built/..... in termial. The apk has been created. Now if the installing fails/takes long time. Go to [app folder\app\outputs\apk]
Copy the app.apk/debug.apk any other file to your device and install it.
Now once you re-run it will work fine.
If that doesn't work flutter clean+flutter pub get. Follow the above step.

Error: Unable to 'pub upgrade' flutter tool. Retrying in five seconds

Log:
E:\Flutter>flutter doctor Checking Dart SDK version... Downloading
Dart SDK from Flutter engine ead227f a... Unzipping Dart SDK...
Updating flutter tool... Error: Unable to 'pub upgrade' flutter tool.
Retrying in five seconds...
Waiting for 0 seconds, press CTRL+C to quit ... Error: Unable to 'pub
upgrade' flutter tool. Retrying in five seconds...
Waiting for 0 seconds, press CTRL+C to quit ... Error: Unable to 'pub
upgrade' flutter tool. Retrying in five seconds...
Waiting for 0 seconds, press CTRL+C to quit ... Error: Unable to 'pub
upgrade' flutter tool. Retrying in five seconds...
Waiting for 0 seconds, press CTRL+C to quit ... Error: Unable to 'pub
upgrade' flutter tool. Retrying in five seconds...
Waiting for 0 seconds, press CTRL+C to quit ... Error: Unable to 'pub
upgrade' flutter tool. Retrying in five seconds...
First Make sure you have a working internet connection and if this issue still exists then, this error may be because the dart sdk may have not been properly downloaded.
The simplest solution is to delete the cache folder located in
flutter/bin(location where flutter is installed) and then Run flutter doctor
I fix that by:
Ctrl+C to stop infinite error loop.
Kill the Dart process in Windows Task Manager.
Delete the cache folder located in flutter/bin directory.
Run in command line flutter pub cache repair.
After that I run flutter doctor and get predictable results:
e:\tools>flutter doctor
Doctor summary (to see all details, run flutter doctor -v):
[√] Flutter (Channel stable, v1.12.13+hotfix.9, on Microsoft Windows [Version
6.1.7601], locale ru-RU)
[√] Android toolchain - develop for Android devices (Android SDK version 28.0.3)
[√] Android Studio (version 3.6)
[!] IntelliJ IDEA Community Edition (version 2019.2)
X Flutter plugin not installed; this adds Flutter specific functionality.
X Dart plugin not installed; this adds Dart specific functionality.
[!] IntelliJ IDEA Ultimate Edition (version 2019.2)
X Flutter plugin not installed; this adds Flutter specific functionality.
X Dart plugin not installed; this adds Dart specific functionality.
[√] VS Code (version 1.44.2)
[√] Connected device (1 available)
! Doctor found issues in 2 categories.
I found my antivirus blocks pub upgrade,I had same issue while hitting flutter doctor, I turned off my antivirus and tried to run "flutter doctor" again, and worked well!
windows:
simplest and easiest way is download the latest version flutter sdk. replace manually current folder by pasting downloaded flutter folder instead of the current folder
in c drive. always choose replace and paste.
after finishing that check with flutter doctor. my issue solved
Solved this issue when Run the CMD as administrative.
This issue will come in protected network as well as due to anti-virus. Even I was facing the same. I downloaded latest stable version manually from the following link, which doesn't required any update process and it works for now..
Download Link For Flutter in Zip format
I updated the flutter SDK via git pull, then the flutter doctor command works.
Just delete the cache folder in flutter/bin and run flutter doctor again!!
Just Deactivate your antivirus and run it again. It would work fine. I had the same issue before.
I deactivated my antivirus for some time and executed flutter doctor command once again in cmd and got fruitful results after hours of patience.
One more thing to note, you should ensure that path of dart-sdk folder should be added to the path in user variables.
It seems it is not being able to "unzip" the downloaded Dart file because it misses 7-zip uncompressor.
I installed it and it worked! It will deal with .7z files.
I hope it works for other people too!!
I had the same problem and it was solved.
Steps:
Download Dart and Filters SDK then Decompress these files and move them to this directory.
C: \
Define the variables in path:
Delete cache directory in flutter/bin
Then run flutter doctor
Make sure you downloaded the windows powershell i use windows 8 it wasn't installed by default , when i downloaded it it worked for me.
Check your flutter bin path in environment variable(User Variables). If not go to Under User variables check if there is an entry called Path:in that add this flutter/bin path.
Strangly when I kill the dart process in Windows Task Manager it is working. But sometimes even when dart process is running update working.
I had to turn off the Android Emulator. It was running for me...
I got the same error and was not able to get rid of it. So I deleted the flutter and instead of cloning it I downloaded the zip from the flutter website and extracted it. Now it works just fine.
Manually downloading the SDK from flutter website fixed the issue.
Still dont know why this problem occured tho.
If you are using Avast (or possibly some other anti virus too) on Mac and have recently updated the OS to Big Sur then follow the below steps to fix this issue
Open Avast and in the Web Shield area disable the "Scan secure connection".
Run flutter config --no-analytics and then run pub upgrade.
This should probably fix the issue.
You can also refer to below threads in Github for more details about the cause
https://github.com/flutter/flutter/issues/40515
https://github.com/flutter/flutter/issues/68999
In my case, the error resolve after adding below folder into exclude option in anti virus
Flutter SDK location
D:\Android\flutter_windows\flutter\*.
Flutter Local Pub folder
C:\Users\hitesh\AppData\Local\Pub
You get the error --
"Pub failed to delete entry because it was in use by another process.
This may be caused by a virus scanner or having a file
in the directory open in another application.
Error (1): Unable to 'pub upgrade' flutter tool. Retrying in five seconds... (1 tries left)" even if you are in one of the flutter directories from Windows explorer. Close the window and try running Flutter doctor. This will resolve.
If anyone faces this problem on macOS with AdGuard installed. Try this:
Go AdGuard Preferences -> Network -> Automatically filter applications -> Select Mode... and change mode to Automatic Proxy.
Pub failed to delete entry because it was in use by another process.
This may be caused by a virus scanner or having a file
in the directory open in another application.
Error (1): Unable to 'pub upgrade' flutter tool. Retrying in five seconds... (9 tries left)
Tried switch to Dev channel and got stuck with "Unable to pub upgrade". Did everything and nothing worked.
This is what I did:
Renamed the Flutter SDK folder
Download the latest Flutter SDK
Extract to the same location of previous renamed SDK
Flutter channel Dev
Flutter upgrade
And everything back to normal.
Source of Problem
It might be possible that you don't have enough free disk space. That's what caused my problems to begin with.
Solution
In my case,
First I had to clean up space to remove any unused files.
Then I had to overwrite the flutter SDK folder due to corruption. The SDK can be found here.
I had the same issue with my MacBook M1. I tried deleting and running flutter pub cache repair But It didn't work for me.
Then I ran the command softwareupdate --install-rosetta and accepted the software licences & agreement (After installing XCode). Now the command flutter works fine. :)
Tried all of the above without success. The search order in the PATH system variable turned out to be the problem:
it was:
G:\My Drive\Compilers\flutter\bin;
G:\My Drive\Compilers\flutter\bin\flutter;
G:\My Drive\Compilers\flutter\bin\flutter.bat;
G:\My Drive\Compilers\flutter\bin\dart.exe;
G:\My Drive\Compilers\flutter\bin\dart;
G:\My Drive\Compilers\flutter\bin\dart.bat;
changed it to:
G:\My Drive\Compilers\flutter\bin\flutter
G:\My Drive\Compilers\flutter\bin\flutter.bat
G:\My Drive\Compilers\flutter\bin\dart
G:\My Drive\Compilers\flutter\bin\dart.bat
that fixed it
Mac auto iCloud upload might be causing the error
If you are using Mac and if your Desktop files are being uploaded to iCloud automatically, sometimes iCloud uploads the "bin" file or the "cache" file inside the flutter file. I've just downloaded the file onto desktop (right click the file -> "Download Now") and it downloaded the file, it ran as usual. (Automatic upload can be turned off from system preferences if youn are getting this error frequently like I was).
For my case, i was using ubuntu, and after reading the above comments, i have come to a resolution that the above error comes as a result of permissions being blocked, accessing cmd with admin access levels solves the problem, e.g on linux run sudo flutter doctor and the problem will be solved.
This error occured to me when i tried upgrading my flutter so it needed admin rights to be upgraded nothing much