android - React Native adb反向错误: more than one device

标签 android react-native adb

我正在学习 React Native。我可以使用 USB 成功连接我的 android 设备。但是当我尝试使用 wifi 连接它时,它给了我一个错误。

$ adb kill-server      
$ adb version
Android Debug Bridge version 1.0.40
Version 4986621
Installed as /home/subtleseeker/Android/Sdk/platform-tools/adb          
$ adb connect 172.26.40.211:8081

* daemon not running. starting it now on port 5037 *
* daemon started successfully *
connected to 172.26.40.211:8081
$ adb devices                   
List of devices attached
172.26.40.211:8081      device

$ react-native run-android
JS server already running.
Building and installing the app on the device (cd android && ./gradlew installDebug)...
Starting a Gradle Daemon, 1 incompatible and 1 stopped Daemons could not be reused, use --status for details
cache results.bin (/home/subtleseeker/.gradle/caches/transforms-1/metadata-1.1/results.bin) is corrupt. Discarding.

> Task :app:installDebug 
Installing APK 'app-debug.apk' on 'POCO F1 - 8.1.0' for app:debug
Installed on 1 device.

BUILD SUCCESSFUL in 31s
27 actionable tasks: 1 executed, 26 up-to-date
Running /home/subtleseeker/Android/Sdk/platform-tools/adb -s 172.26.40.211:8081 reverse tcp:8081 tcp:8081
error: more than one device/emulator
Could not run adb reverse: Command failed: /home/subtleseeker/Android/Sdk/platform-tools/adb -s 172.26.40.211:8081 reverse tcp:8081 tcp:8081
Starting the app on 172.26.40.211:8081 (/home/subtleseeker/Android/Sdk/platform-tools/adb -s 172.26.40.211:8081 shell am start -n com.awe4/com.awe4.MainActivity)...
Starting: Intent { cmp=com.awe4/.MainActivity }

在应用程序的 Dev 设置 中,我已将 Debug server host & port for device 配置为我计算机的 ip 地址 172.26.43.71: 8081。从输出中也可以清楚地看到,连接成功并且安装了 apk。

我看不出如何解决这个错误:错误:不止一个设备/模拟器。任何帮助表示赞赏。
注意:此问题可能与 this 重复, 但它没有任何答案。

最佳答案

当我遇到与以下相同的问题时:

  • Restart adb by issuing adb kill-server followed by adb start-server in a command prompt.
  • Disable and re-enable USB debugging on the phone Rebooting the phone if it still doesn't work.

我的问题已通过这些步骤得到解决。

关于android - React Native adb反向错误: more than one device,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/52749158/

相关文章:

javascript - api调用react-native时Json解析错误

authentication - 是否可以下载音频文件并使用 React Native Expo 播放?

android - 在 Windows 7 上使用 Jelly Bean 4.1 模拟器在 ADB 中运行 systrace 工具时出错

android - ADB 停止在 <waiting for devices>

java - 如何在android导航组件中手动关闭 fragment

java - PhoneGap : Inject JS into HTML on page load through Java on Android

java - Android Studio 多重 Dex 错误

java - Android TCP 服务器消息到桌面 C# 客户端

javascript - 如何在我点击时制作照片按钮并在按住它时录制视频

android - adb: 无法打开 app.apk: 不允许操作