我正在学习React Native。我成功使用USB连接我的安卓设备。但是当我尝试使用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 settings
中,我将Debug server host & port for device
配置为我的电脑IP地址 172.26.43.71:8081
。从输出结果中可以清楚地看到连接成功并且apk已安装。我不知道如何解决这个错误:
error: more than one device/emulator
。希望有所帮助。注意:这个问题可能是一个重复的问题(链接至英文网站),但它没有任何答案。