android - 运行 adb : No Android device found. 时出错请连接设备并按照此处的说明启用 USB 调试:

标签 android reactjs

我是 React-Native 新手,刚刚使用 Expo 在真实设备上运行了我的第一个 hello world 应用程序。

现在,我想在 Android 模拟器上运行第一个 hello world 应用程序。我使用 Android Studio 中的 AVD Manager 设置了一个 AVD。 (棉花糖)

enter image description here

但是,每次都会出现以下错误。

我找不到解决这个问题的方法。

非常感谢任何线索。 迈克

mike@mike-Laptop:~/Desktop/react-native/AwesomeProject$ react-native run-android
Scanning folders for symlinks in /home/mike/Desktop/react-native/AwesomeProject/node_modules (8ms)
03:39:59: Starting packager...
03:44:13: Starting Android...
03:44:18: Packager started!

To view your app with live reloading, point the Expo app to this QR code.
You'll find the QR scanner on the Projects tab of the app.

编辑

这是党卫军....

enter image description here

我得到以下错误....

mike@mike-Laptop:~/Desktop/react-native/AwesomeProject$ react-native run-android
Scanning folders for symlinks in /home/mike/Desktop/react-native/AwesomeProject/node_modules (116ms)
21:59:10: Starting packager...
22:03:47: Starting Android...
22:07:47: Packager started!

To view your app with live reloading, point the Expo app to this QR code.
You'll find the QR scanner on the Projects tab of the app.





























Or enter this address in the Expo app's search bar:

  exp://192.168.1.35:19000

Your phone will need to be on the same local network as this computer.
For links to install the Expo app, please visit https://expo.io.

Logs from serving your app will appear here. Press Ctrl+C at any time to stop.

Error running adb: socket hang up

设备本身无论如何都能被识别,所以问题就解决了,我只需要修复与 android studio 相同的 ADB 的路径....见下文:

mike@mike-Laptop:~/Desktop$ adb devices
List of devices attached
emulator-5554   device

mike@mike-Laptop:~/Desktop$

无论如何感谢您的评论....

Or enter this address in the Expo app's search bar:

  exp://192.168.1.35:19000

Your phone will need to be on the same local network as this computer.
For links to install the Expo app, please visit https://expo.io.

Logs from serving your app will appear here. Press Ctrl+C at any time to stop.

Error running adb: No Android device found. Please connect a device and follow the instructions here to enable USB debugging:
https://developer.android.com/studio/run/device.html#developer-device-options. If you are using Genymotion go to Settings -> ADB, select "Use custom Android SDK tools", and point it at your Android SDK directory.
*** buffer overflow detected ***: adb terminated
======= Backtrace: =========
/lib/x86_64-linux-gnu/libc.so.6(+0x777e5)[0x7f155e2217e5]
/lib/x86_64-linux-gnu/libc.so.6(__fortify_fail+0x5c)[0x7f155e2c315c]
/lib/x86_64-linux-gnu/libc.so.6(+0x117160)[0x7f155e2c1160]
/lib/x86_64-linux-gnu/libc.so.6(+0x1190a7)[0x7f155e2c30a7]
/usr/lib/android/libadb.so.0(_Z11fdevent_setP7fdeventj+0x125)[0x7f155ef2e975]
/usr/lib/android/libadb.so.0(_Z22ss_listener_event_funcijPv+0xcd)[0x7f155ef2533d]
/usr/lib/android/libadb.so.0(_Z12fdevent_loopv+0x94)[0x7f155ef2f144]
adb[0x403de7]
adb[0x404dbe]
/lib/x86_64-linux-gnu/libc.so.6(__libc_start_main+0xf0)[0x7f155e1ca830]
adb[0x403889]
======= Memory map: ========
00400000-00412000 r-xp 00000000 08:05 24651269                           /usr/lib/android-sdk/platform-tools/adb
00612000-00613000 r--p 00012000 08:05 24651269                           /usr/lib/android-sdk/platform-tools/adb
00613000-00614000 rw-p 00013000 08:05 24651269                           /usr/lib/android-sdk/platform-tools/adb
00614000-00624000 rw-p 00000000 00:00 0 
01301000-01333000 rw-p 00000000 00:00 0                                  [heap]
7f1550000000-7f1550021000 rw-p 00000000 00:00 0 
7f1550021000-7f1554000000 ---p 00000000 00:00 0 
7f15577ff000-7f1557800000 ---p 00000000 00:00 0 
7f1557800000-7f1558000000 rw-p 00000000 00:00 0 
7f1558000000-7f1558029000 rw-p 00000000 00:00 0 
7f1558029000-7f155c000000 ---p 00000000 00:00 0 
7f155c64f000-7f155c650000 ---p 00000000 00:00 0 
7f155c650000-7f155ce50000 rw-p 00000000 00:00 0 
7f155ce50000-7f155ce51000 ---p 00000000 00:00 0 
7f155ce51000-7f155d651000 rw-p 00000000 00:00 0 
7f155d651000-7f155d654000 r-xp 00000000 08:05 23068876                   /lib/x86_64-linux-gnu/libdl-2.23.so
7f155d654000-7f155d853000 ---p 00003000 08:05 23068876                   /lib/x86_64-linux-gnu/libdl-2.23.so
7f155d853000-7f155d854000 r--p 00002000 08:05 23068876                   /lib/x86_64-linux-gnu/libdl-2.23.so
7f155d854000-7f155d855000 rw-p 00003000 08:05 23068876                   /lib/x86_64-linux-gnu/libdl-2.23.so
7f155d855000-7f155d95d000 r-xp 00000000 08:05 23068864                   /lib/x86_64-linux-gnu/libm-2.23.so
7f155d95d000-7f155db5c000 ---p 00108000 08:05 23068864                   /lib/x86_64-linux-gnu/libm-2.23.so
7f155db5c000-7f155db5d000 r--p 00107000 08:05 23068864                   /lib/x86_64-linux-gnu/libm-2.23.so
7f155db5d000-7f155db5e000 rw-p 00108000 08:05 23068864                   /lib/x86_64-linux-gnu/libm-2.23.so
7f155db5e000-7f155db64000 r-xp 00000000 08:05 24651263                   /usr/lib/android/liblog.so.0
7f155db64000-7f155dd64000 ---p 00006000 08:05 24651263                   /usr/lib/android/liblog.so.0
7f155dd64000-7f155dd65000 r--p 00006000 08:05 24651263                   /usr/lib/android/liblog.so.0
7f155dd65000-7f155dd66000 rw-p 00007000 08:05 24651263                   /usr/lib/android/liblog.so.0
7f155dd66000-7f155df80000 r-xp 00000000 08:05 23073086                   /lib/x86_64-linux-gnu/libcrypto.so.1.0.0
7f155df80000-7f155e17f000 ---p 0021a000 08:05 23073086                   /lib/x86_64-linux-gnu/libcrypto.so.1.0.0
7f155e17f000-7f155e19b000 r--p 00219000 08:05 23073086                   /lib/x86_64-linux-gnu/libcrypto.so.1.0.0
7f155e19b000-7f155e1a7000 rw-p 00235000 08:05 23073086                   /lib/x86_64-linux-gnu/libcrypto.so.1.0.0
7f155e1a7000-7f155e1aa000 rw-p 00000000 00:00 0 
7f155e1aa000-7f155e36a000 r-xp 00000000 08:05 23068872                   /lib/x86_64-linux-gnu/libc-2.23.so
7f155e36a000-7f155e56a000 ---p 001c0000 08:05 23068872                   /lib/x86_64-linux-gnu/libc-2.23.so
7f155e56a000-7f155e56e000 r--p 001c0000 08:05 23068872                   /lib/x86_64-linux-gnu/libc-2.23.so
7f155e56e000-7f155e570000 rw-p 001c4000 08:05 23068872                   /lib/x86_64-linux-gnu/libc-2.23.so
7f155e570000-7f155e574000 rw-p 00000000 00:00 0 
7f155e574000-7f155e58a000 r-xp 00000000 08:05 23073160                   /lib/x86_64-linux-gnu/libgcc_s.so.1
7f155e58a000-7f155e789000 ---p 00016000 08:05 23073160                   /lib/x86_64-linux-gnu/libgcc_s.so.1
7f155e789000-7f155e78a000 rw-p 00015000 08:05 23073160                   /lib/x86_64-linux-gnu/libgcc_s.so.1
7f155e78a000-7f155e8fc000 r-xp 00000000 08:05 24642822                   /usr/lib/x86_64-linux-gnu/libstdc++.so.6.0.21
7f155e8fc000-7f155eafc000 ---p 00172000 08:05 24642822                   /usr/lib/x86_64-linux-gnu/libstdc++.so.6.0.21
7f155eafc000-7f155eb06000 r--p 00172000 08:05 24642822                   /usr/lib/x86_64-linux-gnu/libstdc++.so.6.0.21
7f155eb06000-7f155eb08000 rw-p 0017c000 08:05 24642822                   /usr/lib/x86_64-linux-gnu/libstdc++.so.6.0.21
7f155eb08000-7f155eb0c000 rw-p 00000000 00:00 0 
7f155eb0c000-7f155eb16000 r-xp 00000000 08:05 24651265                   /usr/lib/android/libcutils.so.0
7f155eb16000-7f155ed15000 ---p 0000a000 08:05 24651265                   /usr/lib/android/libcutils.so.0
7f155ed15000-7f155ed16000 r--p 00009000 08:05 24651265                   /usr/lib/android/libcutils.so.0
7f155ed16000-7f155ed17000 rw-p 0000a000 08:05 24651265                   /usr/lib/android/libcutils.so.0
7f155ed17000-7f155ed1b000 r-xp 00000000 08:05 24651264                   /usr/lib/android/libbase.so.0
7f155ed1b000-7f155ef1a000 ---p 00004000 08:05 24651264                   /usr/lib/android/libbase.so.0
7f155ef1a000-7f155ef1b000 r--p 00003000 08:05 24651264                   /usr/lib/android/libbase.so.0
7f155ef1b000-7f155ef1c000 rw-p 00004000 08:05 24651264                   /usr/lib/android/libbase.so.0
7f155ef1c000-7f155ef3b000 r-xp 00000000 08:05 24651266                   /usr/lib/android/libadb.so.0
7f155ef3b000-7f155f13a000 ---p 0001f000 08:05 24651266                   /usr/lib/android/libadb.so.0
7f155f13a000-7f155f13b000 r--p 0001e000 08:05 24651266                   /usr/lib/android/libadb.so.0
7f155f13b000-7f155f13c000 rw-p 0001f000 08:05 24651266                   /usr/lib/android/libadb.so.0
7f155f13c000-7f155f154000 r-xp 00000000 08:05 23068870                   /lib/x86_64-linux-gnu/libpthread-2.23.so
7f155f154000-7f155f353000 ---p 00018000 08:05 23068870                   /lib/x86_64-linux-gnu/libpthread-2.23.so
7f155f353000-7f155f354000 r--p 00017000 08:05 23068870                   /lib/x86_64-linux-gnu/libpthread-2.23.so
7f155f354000-7f155f355000 rw-p 00018000 08:05 23068870                   /lib/x86_64-linux-gnu/libpthread-2.23.so
7f155f355000-7f155f359000 rw-p 00000000 00:00 0 
7f155f359000-7f155f37f000 r-xp 00000000 08:05 23068868                   /lib/x86_64-linux-gnu/ld-2.23.so
7f155f546000-7f155f54f000 rw-p 00000000 00:00 0 
7f155f57d000-7f155f57e000 rw-p 00000000 00:00 0 
7f155f57e000-7f155f57f000 r--p 00025000 08:05 23068868                   /lib/x86_64-linux-gnu/ld-2.23.so
7f155f57f000-7f155f580000 rw-p 00026000 08:05 23068868                   /lib/x86_64-linux-gnu/ld-2.23.so
7f155f580000-7f155f581000 rw-p 00000000 00:00 0 
7ffd4a004000-7ffd4a026000 rw-p 00000000 00:00 0                          [stack]
7ffd4a109000-7ffd4a10c000 r--p 00000000 00:00 0                          [vvar]
7ffd4a10c000-7ffd4a10e000 r-xp 00000000 00:00 0                          [vdso]
ffffffffff600000-ffffffffff601000 r-xp 00000000 00:00 0                  [vsyscall]

编辑

我点击了错误消息中的链接,结果发现我没有安装“apt-get install android-tools-adb”。所以我安装了它,然后在我连接了两个设备(一个实际的 Nexus 5 和一个 AVD Nexus 6)时运行:

mike@mike-Laptop:~/Desktop$ adb devices 
adb server is out of date.  killing...
* daemon started successfully *
List of devices attached 

mike@mike-Laptop:~/Desktop$ 

请注意,使用 Expo 一切正常。为了开发,我只想能够使用模拟器(无论是 Android 还是 Gynomotion)。

编辑

我设法使用 USB 连接了一个实际设备。尝试过

sudo adb kill-server 
sudo adb start-server 

但是,速度非常慢……在设备 (Nexus 5) 上显示应用程序需要 10 分钟。

但在 Emulator 上运行时仍然有问题。它给出以下错误:

运行 adb 时出错:套接字挂起

编辑

亲爱的加文,

下面是我在 Andr 上的快照。标准。 ...

我期待听到您的意见... 非常感谢

enter image description here

最佳答案

您需要在 android studio 中实际启动您的虚拟设备。当 AS 打开时,单击右上角的模拟器(看起来像手机)按钮,如果您设置正确,它将启动模拟器,然后您可以运行 react-native run-android

enter image description here

enter image description here

关于android - 运行 adb : No Android device found. 时出错请连接设备并按照此处的说明启用 USB 调试:,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/49459647/

相关文章:

java - 提高图片上传质量

javascript - react-router 1.0 : using this. props.children 而不是 RouteHandler

javascript - 如何按顺序动态运行 Promise

reactjs - 如何显示 base64 图像 - React Native

android - 从 Fragment 到 Activity 的数据通信不起作用

android - 如何从过滤列表中滑动删除项目? [回收 View ]

java - 使用 HttpURLConnection 发送 UTF-8 字符串

java - 防止应用程序崩溃的全局方法?

node.js - 尝试安装 React.js 时出现 NPM 错误 TODO-MVC Tutorial

reactjs - mapbox 图层的正确类型( typescript )在哪里?