Error connecting android wear emulator: adb server didn't ack - watchface

I am trying to connect Android Wear emulator to my Android phone through USB cable. I am enterying the command:
adb -d forward tcp:5601 tcp:5601
And I get the following error:
adb server is out of date. killing...
cannot bind 'tcp:5037'
ADB server didn't ACK
* failed to start daemon *
error:
error:
Adb version:
Android Debug Bridge version 1.0.32
I also have installed these addition things:
$ sudo apt-get install lib64stdc++6 (if it is not installed)
$ cd ~/Android/Sdk/tools/lib64/libstdc++
$ mv libstdc++.so.6 libstdc++.so.6.original
$ ln -s /usr/lib64/libstdc++.so.6 ~/Android/Sdk/tools/lib64/libstdc++
$ sudo apt-get install mesa-utils (if it is not installed)
But still, even when I enter the commands below, all I see in Android Wear is "trying to connect..."
adb kill-server
adb start-server
adb -d forward tcp:5601 tcp:5601

Related

Dockerize react-native dev environment & connect Android device to WSL2

I want to dockerize my react native development environment. Currently I have windows on my laptop, and I don't have the option to change that. I also have WSL2 installed and I started to build my dockerfile from this image
I also want to use my device, so I have to somehow connect the container (the docker runs actually in WSL2) with my android device. The WSL2 don't support USB devices (that are connected to the host windows system) currently so I was thinking about setting up a wireless adb connection on the local network but since my android is <11 I have to do some initial setup which requires me to connect adb over USB which is due to the reasons above, not possible... I don't want to use an USB server. Any ideas?
Assuming you have the whole dev-environment setup and working on linux/wsl, you can use socat to relay requests from wsl2 to adb on windows. You may have to deal with some firewall issues, but this works for me:
On Windows:
Run adb -a -P 5037 nodaemon server (credit to this redditor)
In another terminal, run adb devices to ensure your device is properly connected over usb.
On linux/wsl2:
Run socat -d -d TCP-LISTEN:5037,reuseaddr,fork TCP:$(cat /etc/resolv.conf | tail -n1 | cut -d " " -f 2):5037 (credit to this gist)
If you are developing for android with react-native and need to launch the metro bundler, you will need to open a port for the metro bundler on your windows firewall. I will assume you are using port 8081.
Run as administrator in powershell (Windows):
$WSL_CLIENT = bash.exe -c "ip addr show eth0 | grep -oP '(?<=inet\s)\d+(\.\d+){3}'"
iex "netsh interface portproxy add v4tov4 listenport=8081 listenaddress=127.0.0.1 connectport=8081 connectaddress=$WSL_CLIENT"
You should now be able to deploy your project to andriod.
On linux/wsl2:
npx react-native start
npx react-native run-android
If this doesn't work, the credited sources for steps (1) and (3) provide similar methods for achieving this. If you make a docker image, please share it here!

Adb install failed : INSTALL_FAILED_BLOCKED_CROSS_DOWN

trynig to install an apk app using Adb prompt cmd :
C:\adb\platform-tools> .\adb install "C:\adb\platform-tools\myapp.apk"
Performing Streamed Install
and than it says :
adb: failed to install C:\adb\platform-tools\myapp.apk: Failure [INSTALL_FAILED_BLOCKED_CROSS_DOWN: INSTALL_FAILED_BLOCKED_CROSS_DOWN]
PS : i used the adb cmd because the app won't install in normal methode (incompatible device)
my device is samsung A20 .
In my case, I had an incorrectly signed application.
I cleared the project and generated the signed application again and the problem was gone

How to access USB ports from Docker Container on Mac OS

I have created a Docker container for building and testing my Flutter apps. I want to connect my mobile device to the USB port of my Macbook and run Flutter apps directly on the device from the Docker container. But, I am unable to access the USB ports from the container and receiving this error.
I am using Remote Development extension inside my VS Code for running the container.
The devcontainer.json file is attached below:
{
"name": "flutter_docker",
"context": "..",
"dockerFile": "../Dockerfile",
"remoteUser": "developer",
"mounts": [
"source=/dev/bus/usb,target=/dev/bus/usb,type=bind"
],
"settings": {
"terminal.integrated.shell.linux": null
},
"runArgs": ["--privileged"],
"extensions": ["dart-code.flutter"],
"workspaceMount": "source=${localWorkspaceFolder}/workspace,target=/home/developer/workspace,type=bind,consistency=delegated",
"workspaceFolder": "/home/developer/workspace"
}
Whenever I remove the mounts from the json file, it runs fine without any error.
Removing this line:
"mounts": [
"source=/dev/bus/usb,target=/dev/bus/usb,type=bind"
],
Dockerfile:
FROM ubuntu:18.04
# Prerequisites
RUN apt update && apt install -y curl git unzip xz-utils zip libglu1-mesa openjdk-8-jdk wget
# Setup new user
RUN useradd -ms /bin/bash developer
USER developer
WORKDIR /home/developer
# Prepare Android directories and system variables
RUN mkdir -p Android/Sdk
ENV ANDROID_SDK_ROOT /home/developer/Android/Sdk
RUN mkdir -p .android && touch .android/repositories.cfg
# Setup Android SDK
RUN wget -O sdk-tools.zip https://dl.google.com/android/repository/sdk-tools-linux-4333796.zip
RUN unzip sdk-tools.zip && rm sdk-tools.zip
RUN mv tools Android/Sdk/tools
RUN cd Android/Sdk/tools/bin && yes | ./sdkmanager --licenses
RUN cd Android/Sdk/tools/bin && ./sdkmanager "build-tools;29.0.2" "patcher;v4" "platform-tools" "platforms;android-29" "sources;android-29"
# Download Flutter SDK
RUN git clone https://github.com/flutter/flutter.git
ENV PATH "$PATH:/home/developer/flutter/bin"
# Run basic check to download Dark SDK
RUN flutter doctor
Currently, there is an open bug in GitHub about USB Passthrough. Also it was mentioned in the Docker FAQs that it is not possible to pass through a USB device:
Unfortunately, it is not possible to pass through a USB device (or a
serial port) to a container as it requires support at the hypervisor
level.

How to fix the stuck after the command, 'bash flash.sh'

I was trying to flash the mendel-enterprise-chef-13 to the Coral EdgeTPU Development Board but got stuck after the command, "bash flash.sh."
The host computer is the MacBook Pro (2018) with macOS Mojave ver. 10 and connected with the Coral EdgeTPU Dev Board.
I have followed the instructions on the Coral Document listed at https://coral.withgoogle.com/docs/dev-board/get-started/.
The process went smooth up to without the problem untill the step 8 and 12.
mkdir -p ~/.local/bin
sudo mv ~/Downloads/platform-tools/fastboot ~/.local/bin/
pip3 install --user mendel-development-tool
and then install the CP210x USB to UART Bridge Virtual COM Port (VCP) driver for Mac.
screen /dev/cu.SLAB_USBtoUART 115200
fastboot 0
fastboot devices
1b0741d6f0609912 fastboot # I did not get this message
cd ~/Downloads
curl -O https://dl.google.com/coral/mendel/enterprise/mendel-enterprise-chef-13.zip
unzip mendel-enterprise-chef-13.zip \
&& cd mendel-enterprise-chef-13
bash flash.sh # Got stuck here.
I want to know how to fix the issues of flashing the mendel image.
this sounds like a problem with the USB-A USB-C cable, or the usb port on your host machine, have you tried a different port?

How to start emulator and install apk from terminal

I wrote a bash file to start an emulator and install apk with the commands,
emulator -avd emulatorName
adb wait-for-device
adb install OpenManager.apk
but when i run the file from terminal it starts the emulator and it hangs there it doesn't execute the command to install the apk. But when i close the emulator then it execute the install command. Please, can someone help on how to do that.
Add an & to run the emulator process in the background:
emulator -avd emulatorName & adb wait-for-device && sleep 5 && adb install OpenManager.apk
and the && to run the following command if the previous succeeded.

Resources