Search code examples
androidreact-nativetcpandroid-emulatoradb

ADB error - unable to run React Native project in an emulator


The story started when I try to run my project in my external device. Then the error occurred, I searched for a solution online and I encounter a suggestion/solution to use lsusb and change something about submit and so on. Then I'm still unable to run my project in my external device. I gave up and wanted to continue my development using emulator. Then when I try to run React Native run-android, this error come out:

Installing APK 'app-debug.apk' on 'Nexus_5X_API_26(AVD) - 8.0.0' for app:debug
Installed on 1 device.

BUILD SUCCESSFUL

Total time: 2 mins 23.127 secs
Running /root/Android/Sdk/platform-tools/adb -s emulator-5554 reverse tcp:8081 tcp:8081
adb server version (32) doesn't match this client (39); killing...
* daemon started successfully *
error: device offline
Could not run adb reverse: Command failed: /root/Android/Sdk/platform-tools/adb -s emulator-5554 reverse tcp:8081 tcp:8081
Starting the app on emulator-5554 (/root/Android/Sdk/platform-tools/adb -s emulator-5554 shell am start -n com.project_1/com.project_1.MainActivity)...
error: device offline

Note: I checked ADB devices and it shows emulator-5554 device.

Before installing and failing to run project on the emulator, the emulator works just fine and smooth, after failing the emulator can't be clicked and everything.

Please give me a solution.


Solution

  • i finally solved it i check my adb version which is 32 then i check my adb in sdk folder version which is 39 then i do copy adb from sdk folder to usr/bin

    $ sudo cp ~/Android/Sdk/platform-tools/adb /usr/bin
    

    it will make the adb version to 39