ADB will not install APK file on Android Emulator. Just says: "Performing Streamed Install" - android-emulator

ADB will not install my 32-bit APK file on an emulator. But it is not showing any error message when trying to install it:
In Android Studio 4.2.2 (on my Ubuntu 20.04.2 LTS laptop) I installed an emulator: Pixel_2_API_27_Android_8.1_x86_
I then open a Terminal window and do this:
:~$ /home/henrik/Android/Sdk/platform-tools/adb start-server
* daemon not running; starting now at tcp:5037
* daemon started successfully
:~$ which adb
:~$ /home/henrik/Android/Sdk/platform-tools/adb devices -l
List of devices attached
:~$ emulator #Pixel_2_API_27_Android_8.1_x86_
emulator: Android emulator version 30.7.4.0 (build_id 7453540) (CL:N/A)
handleCpuAcceleration: feature check for hvf
cannot add library /home/henrik/Android/Sdk/emulator/qemu/linux-x86_64/lib64/vulkan/libvulkan.so: failed
added library /home/henrik/Android/Sdk/emulator/lib64/vulkan/libvulkan.so
cannot add library /home/henrik/Android/Sdk/emulator/lib64/vulkan/libvulkan.so.1: full
emulator: INFO: GrpcServices.cpp:315: Started GRPC server at 127.0.0.1:8554, security: Local
emulator: INFO: EmulatorAdvertisement.cpp:93: Advertising in: /run/user/1000/avd/running/pid_68812.ini
qemu-system-i386: warning: TSC frequency mismatch between VM (2711993 kHz) and host (2711986 kHz), and TSC scaling unavailable
In a new Terminal tab I do this:
:~$ /home/henrik/Android/Sdk/platform-tools/adb devices -l
List of devices attached
emulator-5554 device product:sdk_gphone_x86 model:Android_SDK_built_for_x86 device:generic_x86 transport_id:1
:~$ /home/henrik/Android/Sdk/platform-tools/adb -s emulator-5554 install /mnt/4AF15A0435E762B4/mypython/storage/bin/storage-0.1-armeabi-v7a-debug.apk
Performing Streamed Install
But then, nothing happens. (I waited a very long time.)
If I copy the APK file to my physical MOTO G5 Android 8.1.0 phone and install it, at least I get en error message showing that it DID install.

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.

Can't sync android emulator with flutter project

Could Not Find C:\Users\Mohammed\AppData\Local\Android\sdk\platform-tools\AdbWinApi.dll.dat
The directory name is invalid.
W/FlutterActivityAndFragmentDelegate( 9139): A splash screen was provided to Flutter, but this is deprecated. See flutter.dev/go/android-splash-migration for migration steps.
Error waiting for a debug connection: ProcessException: adb returned error:
The directory name is invalid.
Could Not Find C:\Users\Mohammed\AppData\Local\Android\sdk\platform-tools\AdbWinApi.dll.dat
Command: C:\Users\Mohammed\AppData\Local\Android\sdk\platform-tools\adb.exe -s emulator-5554 forward tcp:0 tcp:42601
Error launching application on Android SDK built for x86.
Exited (sigterm)
I solved this issue by the following 3 steps:
1 remove the sdk and emulator.
2 install again the sdk and emulator.
3 restart my computer
and then then solved it

Mac and "PANIC: Missing emulator engine program for 'arm' CPU."

I am attempting to run an AVD I have created for API 16 on a Galaxy Nexus:
emulator #Galaxy_Nexus_Jelly_Bean_API_16
which gives the error
PANIC: Missing emulator engine program for 'arm' CPU.
Attempting to start it by pressing the play button from the AVD Manager inside Android Studio bounces something briefly in the tool dock, but it quickly vanishes and nothing shows up and there are no obvious error messages.
I have looked through other posts with similar problems. Most cite Avast on Windows as causing the issue. I am running on a Mac. I do not have Avast installed.
The AVD has the following configuration:
Name: Galaxy_Nexus_Jelly_Bean_API_16
CPU/ABI: Google APIs ARM (armeabi-v7a)
Path: /Users/prisoner/.android/avd/Galaxy_Nexus_API_16.avd
Target: google_apis [Google APIs] (API level 16)
Skin: galaxy_nexus
SD Card: 100 MB
hw.dPad: no
hw.lcd.height: 1280
runtime.network.speed: full
hw.accelerometer: yes
hw.device.name: Galaxy Nexus
vm.heapSize: 80
skin.dynamic: yes
hw.device.manufacturer: Google
hw.lcd.width: 720
hw.gps: yes
hw.initialOrientation: Portrait
image.androidVersion.api: 16
hw.audioInput: yes
image.sysdir.1: add-ons/addon-google_apis-google-16/images/armeabi-v7a/
hw.cpu.model: cortex-a8
tag.id: google_apis
showDeviceFrame: yes
hw.camera.back: virtualscene
hw.mainKeys: no
AvdId: Galaxy_Nexus_Jelly_Bean_API_16
hw.camera.front: emulated
hw.lcd.density: 320
avd.ini.displayname: Galaxy Nexus Jelly Bean API 16
hw.arc: false
hw.gpu.mode: auto
hw.device.hash2: MD5:5c288d27461585ecc73a535555e7cf61
hw.ramSize: 1024
hw.trackBall: no
PlayStore.enabled: false
fastboot.forceColdBoot: no
hw.battery: yes
hw.cpu.ncore: 4
hw.sdCard: no
tag.display: Google APIs
runtime.network.latency: none
hw.keyboard: yes
hw.sensors.proximity: yes
disk.dataPartition.size: 800M
hw.sensors.orientation: yes
avd.ini.encoding: UTF-8
hw.gpu.enabled: yes
Android Studio environment:
Android Studio 3.1.4
Build #AI-173.4907809, built on July 23, 2018
JRE: 1.8.0_152-release-1024-b01 x86_64
JVM: OpenJDK 64-Bit Server VM by JetBrains s.r.o
Mac OS X 10.12.6
I have installed everything for this version of the SDK available in the SDK Manager:
I have the latest version of the emulator installed. I've tried uninstalling and re-installing it.
The ANDROID_HOME environment variable appears to be correctly set (it matches the Android SDK location in the SDK Manager. The emulator program appears to be the one under this home environment as well:
Mulan:~ prisoner$ echo $ANDROID_HOME
/Users/prisoner/Library/Android/sdk
Mulan:~ prisoner$ which emulator
/Users/prisoner/Library/Android/sdk/tools/emulator
As far as I can tell, the emulator and the architecture-specific emulators are also under ANDROID_HOME:
I'm at a loss about where else to look, either for error messages or the emulator that is there, but can't be found by the system, or how else to address the problem.
Update 1: Specify path explicitly.
Trying to specify the paths explicitly doesn't work either:
Mulan:~ prisoner$ /Users/prisoner/Library/Android/sdk/tools/emulator #Galaxy_Nexus_Jelly_Bean_API_16
PANIC: Missing emulator engine program for 'arm' CPU.
Mulan:~ prisoner$ /Users/prisoner/Library/Android/sdk/emulator/emulator #Galaxy_Nexus_Jelly_Bean_API_16
emulator: ERROR: This AVD's configuration is missing a kernel file! Please ensure the file "kernel-qemu" is in the same location as your system image.
emulator: ERROR: ANDROID_SDK_ROOT is undefined
Sure enough, ANDROID_SDK_ROOT isn't defined. Defining it to the same thing as ANDROID_HOME does the following:
Mulan:~ prisoner$ export ANDROID_SDK_ROOT="$ANDROID_HOME"
Mulan:~ prisoner$ /Users/prisoner/Library/Android/sdk/emulator/emulator #Galaxy_Nexus_Jelly_Bean_API_16
emulator: ERROR: This AVD's configuration is missing a kernel file! Please ensure the file "kernel-qemu" is in the same location as your system image.
emulator: ERROR: ANDROID_SDK_ROOT is defined (/Users/prisoner/Library/Android/sdk) but cannot find kernel file in /Users/prisoner/Library/Android/sdk/system-images/ sub directories
Looking underneath the system-images directory, we see a directory for each API platform:
Mulan:~ prisoner$ ls ~/Library/Android/sdk/system-images/
android-16 android-19 android-23 android-26
android-17 android-21 android-24 android-27
android-18 android-22 android-25 android-28
Looking just under the android-16 directory, we have
./default
./default/armeabi-v7a
./default/armeabi-v7a/build.prop
./default/armeabi-v7a/kernel-qemu
./default/armeabi-v7a/NOTICE.txt
./default/armeabi-v7a/package.xml
./default/armeabi-v7a/ramdisk.img
./default/armeabi-v7a/source.properties
./default/armeabi-v7a/system.img
./default/armeabi-v7a/userdata.img
./default/mips
./default/mips/build.prop
./default/mips/kernel-qemu
./default/mips/NOTICE.txt
./default/mips/package.xml
./default/mips/ramdisk.img
./default/mips/source.properties
./default/mips/system.img
./default/mips/userdata.img
./default/x86
./default/x86/build.prop
./default/x86/kernel-qemu
./default/x86/kernel-ranchu
./default/x86/NOTICE.txt
./default/x86/package.xml
./default/x86/ramdisk.img
./default/x86/source.properties
./default/x86/system.img
./default/x86/userdata.img
./google_apis
./google_apis/x86
./google_apis/x86/advancedFeatures.ini
./google_apis/x86/build.prop
./google_apis/x86/kernel-qemu
./google_apis/x86/kernel-ranchu
./google_apis/x86/NOTICE.txt
./google_apis/x86/package.xml
./google_apis/x86/ramdisk.img
./google_apis/x86/source.properties
./google_apis/x86/system.img
./google_apis/x86/userdata.img
Just tried and verified on my Mac, to solve this problem, you need to specify the -kernel path manually. i.e.
$ ~/Library/Android/sdk/emulator/emulator #Galaxy_Nexus_Jelly_Bean_API_16 -kernel ~/Library/Android/sdk/system-images/android-16/default/armeabi-v7a/kernel-qemu
Some references for you:
Emulator error: This AVD's configuration is missing a kernel file
https://developer.android.com/studio/run/emulator-commandline
--- Edit ---
To avoid typing the -kernel argument every time, you can also copy the ~/Library/Android/sdk/system-images/android-16/default/armeabi-v7a/kernel-qemu file to ~/Library/Android/sdk/add-ons/addon-google_apis-google-16/images/armeabi-v7a.
Maybe it is the emulator tool path issue. Try to specify the full path of your emulator path.
Try the answer from here. Windows emulator.exe PANIC: Missing emulator engine program for 'x86' CPU
[Partial answer - to a related issue on the IDE]
I have faced this problem also. My Android Studio couldn't even start the emulator, coming up with an error like "Emulator: Process finished with exit code 1". The fix there was to install/update the relevant system images under SDK Manager -> SDK Platforms (tab) -> Click "Show Package Details" and then "Apply".
However, this doesn't seem to make the CLI command emulator -avd <avd name> run, instead I see the PANIC error, but apparently it's related to the migration of the emulator from the SDK path /tools to /emulator

Appcelerator can start Genymotion emulator, but can't install package: "device not found"

On Win10, I have the following installed:
Appcelerator Studio
Appcelerator CLI
Android SDK (ADB enabled)
Genymotion (free / private license)
I'm using regular Windows Command Prompt to interact with Appcelerator, trying to run a project via a Genymotion emulator (it's the Appcelerator RSS Reader demo project). I've gotten it to the point where appc run --platform android will spin up Genymotion and start the appropriate emulator (the only device available according to the Android SDK Virtual Device Manager).
However, as soon as the emulator is ready, Appc tries to install the apk, and fails with this message:
[INFO] Making sure the adb server is running
[INFO] Installing apk: C:\Users\USERNAME\Documents\Appcelerator_Studio_Workspace\Rss Reader\build\android\bin\RSS Reader.apk
[ERROR] Failed to install apk on "192.168.128.101:5555"
[ERROR] Error: device not found
If Appc can find the appropriate emulator to start it up, why does installation fail with "device not found"?
If I immediately open a new console and check the adb connections, I see the specified device as connected:
>C:\Users\USERNAME\AppData\Local\Android\sdk\platform-tools>adb devices<br />
List of devices attached
192.168.128.101:5555 device
I have tried the following to troubleshoot:
Made sure SDK and ADB paths were correct
Made sure Genymotion paths were correct
Made sure the emulator has the correct API (25) and OS version (7.1.0)
Just a note, when I try to run appc run --platform android without the emulator / Genymotion started, it will spin up the emulator perfectly but never recognizes it being "ready", and fails with the following:
[INFO] Waiting for emulator to become ready...
[ERROR] Emulator failed to start in a timely manner
The current timeout is set to 120000 ms
If the emulator is already started, it completes as described in the top, with the "device not found" error.
Appc info (generated by Appc CLI on "run"):
Operating System
Name = Microsoft Windows 10 Enterprise
Version = 10.0.14393
Architecture = 64bit
# CPUs = 4
Memory = 17037770752
Node.js
Node.js Version = 6.11.3
npm Version = 3.10.10
Titanium CLI
CLI Version = 5.0.14
Titanium SDK
SDK Version = 6.2.2.GA
SDK Path = C:\ProgramData\Titanium\mobilesdk\win32\6.2.2.GA
Target Platform = android
Try use this:
appc run -p android -C "(name of genymotion virtual device)"

screenrecord not working in emulator

Since 4.4 KitKat, Android has a shell utility screenrecord to record the Android device screen.
If I connect a physical device with the adb utility over USB, I can do the following:
adb shell screenrecord /sdcard/sample.mp4
adb pull /sdcard/sample.mp4
But if I do the above for an Android emulator, I will get an empty sample.mp4 file.
adb shell screenrecord /sdcard/sample.mp4
adb shell ls -l /sdcard/sample.mp4
-rw-rw---- root sdcard_r 0 2016-06-18 05:37 sample.mp4
If I execute screenrecord directly in a root console in emulator, I see the following:
root#flo:/system/bin # ./screenrecord /sdcard/sample.mp4
[1] + Stopped (signal) ./screenrecord /sdcard/sample.mp4
root#flo:/system/bin #
[1] + Illegal instruction ./screenrecord /sdcard/sample.mp4
Why does screenrecord not work for emulator?
Screenrecord uses MediaCodec API. https://developer.android.com/reference/android/media/MediaCodec.html
To be precise, Screenrecord directly calls the native interface of MediaCodec.
To the best of my knowledge, no emulator supports MediaCodec yet. They all support higher level interface MediaPlayer https://developer.android.com/reference/android/media/MediaPlayer.html.
Screenrecord is working with Android Emulator v27.0.2.
I've tested it with Oreo x86 with Google Play image, but it should work with any KitKat+ image.