2
votes

I am working on react native I am beginner and I facing problem to set the environment for react native. I have followed 'https://facebook.github.io/react-native/docs/getting-started' and installing on ubuntu but when I run the command 'react-native run-android' I get the errors: Starting a Gradle Daemon (subsequent builds will be faster) [adb]: adb server version (31) doesn't match this client (40); killing... [adb]: * daemon started successfully

Task :app:installDebug Installing APK 'app-debug.apk' on 'Nexus_6_API_27(AVD) - 8.1.0' for app:debug Installed on 1 device.

BUILD SUCCESSFUL in 37s 27 actionable tasks: 1 executed, 26 up-to-date Running /home/shafi/Android/Sdk/platform-tools/adb -s emulator-5554 reverse tcp:8081 tcp:8081 adb server version (31) doesn't match this client (40); killing... * daemon started successfully Starting the app on emulator-5554 (/home/shafi/Android/Sdk/platform-tools/adb -s emulator-5554 shell am start -n com.namal/com.namal.MainActivity)... Starting: Intent { cmp=com.namal/.MainActivity }

4

4 Answers

1
votes

Try these 2 commands with sudo

adb kill-server
adb start-server

Then run react-native run-android command and see if it's work.

If it is not working, try below commands

   adb kill-server
   emulator -avd Nexus_6_API_27 -port 5557
   adb start-server

Then run react-native run-android command.

1
votes

I have tried different solution, But below works for me -

  1. Under Home folder (eg:- C:\Users\Lenovo) > find and delete .Android folder

  2. Goto, C:\Users\Lenovo\AppData\Local\Android > delete platform-tools folder

  3. Again install/download from Android SDK Manager (note: you can open android studio -> tool -> SDK Manager select (eg Android 9.0) apply and ok

  4. ( reopen android studio then you can see connected device)

  5. if you use visor/ total controller :-

           Open terminal -
                  adb kill-server
                  adb start-server
    
  6. Check adb devices, It will work and display you all connected devices.

0
votes

when I tried the above commands still there was problem of adb is out of date then I find a link ('adb server is out of date. killing') to change my bin because I was having problem with adb and I used these two following commands and it worked

Blockquote

sudo cp ~/Android/Sdk/platform-tools/adb /usr/bin/adb 
sudo chmod +x /usr/bin/adb
0
votes

On Windows, you can check Task Manager to see what adb.exe processes are running. You can right-click on one of these processes to see the location of the adb.exe file, which may show that it's running as part of an program other than the Android SDK / React-Native.

In my case, I found that the Oculus Developer Hub program came with its own version of ADB, and that copying the following files from my Unity platform-tools folder (in your case, you'd want your Android SDK platform-tools folder) into the Oculus Developer Hub folder resolved the issue - you may just want to uninstall the offending software, but copying the files across should ensure that adb versions are compatible. After copying the files, I ran stopped any adb.exe processes running (using Task Manager), and then restarted Unity.

Files:

  • adb.exe
  • AdbWinApi.dll
  • AdbWinUsbApi.dll