react-native run-android mismatch version adb server version - android

I recently install react-native, initialize a project and run it
$ react-native init AwesomeProject
$ react-native run-android
Always get a error
adb server version (32) doesn't match this client (36); killing...
and my device shows me
How to solve both error?

This is because the adb version on your system is different from the adb version on the android sdk platform-tools. you can check that to insure:
Open the terminal and check the adb version on the system:
$adb version
And from the Android SDK platform-tool directory:
$cd ~/Android/Sdk/platform-tools
$./adb version
simple solution:
Copy adb from Android SDK directory to usr/bin directory.
$sudo cp ~/Android/Sdk/platform-tools/adb /usr/bin

Did you brew install android-sdk?
I was getting the following error when running react-native run-android:
adb server version (36) doesn't match this client (39); killing...
error: could not install *smartsocket* listener: Address already in use
ADB server didn't ACK
* failed to start daemon *
error: cannot connect to daemon
Could not run adb reverse: Command failed: /Users/beau/Library/Android/sdk/platform-tools/adb -s emulator-5554 reverse tcp:8081 tcp:8081
I found that I had adb installed at /usr/local/bin/adb:
$ ll /usr/local/bin/adb
lrwxr-xr-x 1 beau admin 38 Mar 13 12:12 /usr/local/bin/adb# -> ../Cellar/android-sdk/24.4.1_1/bin/adb
It was installed with brew install android-sdk and never used, so I uninstalled it:
brew uninstall android-sdk
…and the adb error was gone when I re-ran react-native run-android.

Thanks , this solution works for me. I have been struggling with this problem for few days, reinstall android studio, add custom android Sdk tools path under Genymotion ADB setting nothing works.Just wants to share with who have the same issues.
I use Ubuntu 16.04. I did the copy adb to /usr/bin as suggested, since the adb version I have is 1.0.32.
/usr/local$ adb version
Android Debug Bridge version 1.0.39
Revision 3db08f2c6889-android
Installed as /usr/bin/adb
Then I updated ADB setting under Genymotion to the default, use Genymotion Android tools. And start virtual device.
Under Expo XDE, start the project, then click device. Then I see the following message.
Couldn't adb reverse: closed
Opening on Android device
Building JavaScript bundle: finished in 3669ms.
It works!!!

Related

adb server version (41) doesn't match this client (39)

im using OS ubuntu and im not using GenyMobile.
terminal
I did my digging for a while as the accepted answer did not work and landed on this solution
[I am on Ubuntu 20.04.2 LTS]
What is causing it to happen?
A clash between two different adb in the system. One in android/sdk/platform-tools and another in usr/bin
What will we do?
delete the adb located in usr/bin, then copy from platform-tools and paste in the usr/bin
Steps:
open the usr/bin in terminal as:
sudo nautilus
locate and delete adb in usr/bin
open sdk/platform-tools, copy paste adb to above usr/bin
lastly perform this in terminal:
sudo apt update && sudo apt install android-sdk
I ran into the same problem on ubuntu 20. This seems to be caused by apt installing a different version of adb than the one that Android Studio or other SDK tools download. I don't remember ever installing adb with apt. It was probably pulled in as a dependency.
My solution was similar to Kushagra's, but I used bash and had to kill the adb server to finally get rid of the error
# Print some info to verify what is going on
> lsb_release -sr
20.04
> which adb
/usr/bin/adb
> /usr/bin/adb --version
Android Debug Bridge version 1.0.39
Version 1:8.1.0+r23-5ubuntu2
> ~/Android/Sdk/platform-tools/adb --version
Android Debug Bridge version 1.0.41
Version 33.0.2-8557947
> apt list --installed | grep adb
adb/focal,now 1:8.1.0+r23-5ubuntu2 amd64 [installed,automatic]
##############################################
# OK, quit horsing around and fix the problem
> adb kill-server
> sudo mv /usr/bin/adb /usr/bin/adb-1.0.39
> sudo cp ~/Android/Sdk/platform-tools/adb /usr/bin
> adb --version
Android Debug Bridge version 1.0.41
> adb start-server
Beware of the capital 'S' in Sdk. That is where my Android Studio chipmunk installed it, but I think older versions were lower cased as sdk.
Also keep in mind that this solution overwrites the system version installed by apt. That might be unwise, and is likely temporary. If that is a problem, consider copying in the other direction instead : from /usr/lib to ~/Android/Sdk/platform-tools. Links might be wiser than making file copies.
You can be used to uninstall an app via your PC. It will solve your issue.
1. First step: select File-> Invalidate caches / Restart
2. Second step: open a command terminal and run the below command changing the package name.
3. Final step: Now run your app
replace: < com.xyz.name > with your < package name >
adb uninstall "com.xyz.name"

ReactNative app is successfully installed but it's not started from WebStorm

When I try to build ReactNative app for my devices I get this:
BUILD SUCCESSFUL
Total time: 25.191 secs
This build could be faster, please consider using the Gradle Daemon: https://docs.gradle.org/2.14.1/userguide/gradle_daemon.html
Starting the app (adb shell am start -n com.neborofeed/com.neborofeed.MainActivity.../bin/sh: adb: command not found
The app is installed on my device, but it's not started automatically. When I copy this command to the terminal adb shell am start -n com.neborofeed/com.neborofeed.MainActivity, the app is started as expected.
It's seems that the script is not able to find adb, have you added the PATH in your ~/.bash_profile or similar?
If you have not try running:
echo "export PATH=\$PATH:/Users/${USER}/Library/Android/sdk/platform-tools/" >> ~/.bash_profile
If you have your sdk in a different directory, then update the path in the command above.
I have tried with this one then work for me after restart MAC
Noted: Don't forget to restart your MAC

android studio install error [INSTALL_FAILED_INVALID_APK]

I am getting this:
01/20 17:14:40: Launching MyLuaGame $ adb push /Users/name/Desktop/MyLuaGame/frameworks/runtime-src/proj.android-studio/app/build/outputs/apk/MyLuaGame-debug.apk /data/local/tmp/myTest
$ adb shell pm install -r "/data/local/tmp/myTest" Please select on your phone whether can install the app by The ADB command?
pkg: /data/local/tmp/myTest Failure [INSTALL_FAILED_INVALID_APK]
$ adb shell pm uninstall myTest DELETE_FAILED_INTERNAL_ERROR
Error while Installing APK
You have to execute a release apk for installation in device. You can connect your device in android studio and get the debug version app but in order to get an apk to install other devices, you must execute release version apk using a keystore
A common reason for this error is having an app with the same package name already installed but with a different certificate e.g. a store release or a development build from another machine.
Try uninstalling the package with ADB first, using adb uninstall YOUR_PACKAGE_NAME

Android studio - unable to locate adb on ubuntu

I am trying to install Android Studio on my ubuntu 14.
Following the official guide While the setup wizard is downloading the components, I get this message:
....
Updated ADB to support the USB devices declared in the SDK add-ons.
Stopping ADB server failed (code -1).
Unable to run 'adb': Cannot locate program "/home/muser/Android/Sdk/platform-tools/adb": error=2, No such file or directory.
Starting ADB server failed (code -1).
....
There are no Android folder under /home/muser
Why is it searching it in that directory?
How to fix it?
After installing Android Studio, just run the following command.
sudo apt-get install android-tools-adb
[EDIT] - I installed Android Studio from here
It's not adb. It is android-tools-adb. Hence you need to use -
sudo apt-get install android-tools-adb

Android: ADB is somehow not working (on Fedora 16)

I'm running Fedora 16 x64 with xfce desktop. Installation of Android Developer Tools (adt plugin) was successfull from Eclipse. I can even run an Emulator. It's just that adb command is not working from the Linux command line. Even if I cd to the platform-tools folder and run adb devices I get this output:
bash: adb: command not found
Eclipse also reports an error about this. By the way adb file is marked as executable. Any help would be great...
I think the problem was already addressed here:
Problem with Android SDK on Fedora 14 with Eclipse
and here
Android SDK on a 64-bit linux machine
Please let me know.
adb is located under folder platform-tools and in order to run it you have 2 options.
Option 1: Add the SDK/platform-tools folder into your shell PATH (BASH I guess)
Option 2: go under the platform-tools folder and run it using: ./adb
for instance ./adb logcat
Cheers
sudo yum install android-tools -y

Categories

Resources