我是 React-Native 新手,刚刚使用 Expo 在真实设备上运行了我的第一个 hello world 应用程序。
现在,我想在 Android 模拟器上运行第一个 hello world 应用程序。我使用 Android Studio 中的 AVD Manager 设置了一个 AVD。 (棉花糖)
但是,每次都会出现以下错误。
我找不到解决这个问题的方法。
非常感谢任何线索。 迈克
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.
编辑
这是党卫军....
我得到以下错误....
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 上的快照。标准。 ...
我期待听到您的意见... 非常感谢
最佳答案
您需要在 android studio 中实际启动您的虚拟设备。当 AS 打开时,单击右上角的模拟器(看起来像手机)按钮,如果您设置正确,它将启动模拟器,然后您可以运行 react-native run-android
关于android - 运行 adb : No Android device found. 时出错请连接设备并按照此处的说明启用 USB 调试:,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/49459647/
总的来说,我对ruby还比较陌生,我正在为我正在创建的对象编写一些rspec测试用例。许多测试用例都非常基础,我只是想确保正确填充和返回值。我想知道是否有办法使用循环结构来执行此操作。不必为我要测试的每个方法都设置一个assertEquals。例如:describeitem,"TestingtheItem"doit"willhaveanullvaluetostart"doitem=Item.new#HereIcoulddotheitem.name.shouldbe_nil#thenIcoulddoitem.category.shouldbe_nilendend但我想要一些方法来使用
我正在用Ruby编写一个简单的程序来检查域列表是否被占用。基本上它循环遍历列表,并使用以下函数进行检查。require'rubygems'require'whois'defcheck_domain(domain)c=Whois::Client.newc.query("google.com").available?end程序不断出错(即使我在google.com中进行硬编码),并打印以下消息。鉴于该程序非常简单,我已经没有什么想法了-有什么建议吗?/Library/Ruby/Gems/1.8/gems/whois-2.0.2/lib/whois/server/adapters/base.
我想为Heroku构建一个Rails3应用程序。他们使用Postgres作为他们的数据库,所以我通过MacPorts安装了postgres9.0。现在我需要一个postgresgem并且共识是出于性能原因你想要pggem。但是我对我得到的错误感到非常困惑当我尝试在rvm下通过geminstall安装pg时。我已经非常明确地指定了所有postgres目录的位置可以找到但仍然无法完成安装:$envARCHFLAGS='-archx86_64'geminstallpg--\--with-pg-config=/opt/local/var/db/postgresql90/defaultdb/po
在选择我想要运行操作的频率时,唯一的选项是“每天”、“每小时”和“每10分钟”。谢谢!我想为我的Rails3.1应用程序运行调度程序。 最佳答案 这不是一个优雅的解决方案,但您可以安排它每天运行,并在实际开始工作之前检查日期是否为当月的第一天。 关于ruby-如何每月在Heroku运行一次Scheduler插件?,我们在StackOverflow上找到一个类似的问题: https://stackoverflow.com/questions/8692687/
exe应该在我打开页面时运行。异步进程需要运行。有什么方法可以在ruby中使用两个参数异步运行exe吗?我已经尝试过ruby命令-system()、exec()但它正在等待过程完成。我需要用参数启动exe,无需等待进程完成是否有任何rubygems会支持我的问题? 最佳答案 您可以使用Process.spawn和Process.wait2:pid=Process.spawn'your.exe','--option'#Later...pid,status=Process.wait2pid您的程序将作为解释器的子进程执行。除
我尝试运行2.x应用程序。我使用rvm并为此应用程序设置其他版本的ruby:$rvmuseree-1.8.7-head我尝试运行服务器,然后出现很多错误:$script/serverNOTE:Gem.source_indexisdeprecated,useSpecification.Itwillberemovedonorafter2011-11-01.Gem.source_indexcalledfrom/Users/serg/rails_projects_terminal/work_proj/spohelp/config/../vendor/rails/railties/lib/r
Sinatra新手;我正在运行一些rspec测试,但在日志中收到了一堆不需要的噪音。如何消除日志中过多的噪音?我仔细检查了环境是否设置为:test,这意味着记录器级别应设置为WARN而不是DEBUG。spec_helper:require"./app"require"sinatra"require"rspec"require"rack/test"require"database_cleaner"require"factory_girl"set:environment,:testFactoryGirl.definition_file_paths=%w{./factories./test/
我正在尝试编写一个将文件上传到AWS并公开该文件的Ruby脚本。我做了以下事情:s3=Aws::S3::Resource.new(credentials:Aws::Credentials.new(KEY,SECRET),region:'us-west-2')obj=s3.bucket('stg-db').object('key')obj.upload_file(filename)这似乎工作正常,除了该文件不是公开可用的,而且我无法获得它的公共(public)URL。但是当我登录到S3时,我可以正常查看我的文件。为了使其公开可用,我将最后一行更改为obj.upload_file(file
GivenIamadumbprogrammerandIamusingrspecandIamusingsporkandIwanttodebug...mmm...let'ssaaay,aspecforPhone.那么,我应该把“require'ruby-debug'”行放在哪里,以便在phone_spec.rb的特定点停止处理?(我所要求的只是一个大而粗的箭头,即使是一个有挑战性的程序员也能看到:-3)我已经尝试了很多位置,除非我没有正确测试它们,否则会发生一些奇怪的事情:在spec_helper.rb中的以下位置:require'rubygems'require'spork'
是否有可能:before_filter:authenticate_user!||:authenticate_admin! 最佳答案 before_filter:do_authenticationdefdo_authenticationauthenticate_user!||authenticate_admin!end 关于ruby-on-rails-before_filter运行多个方法,我们在StackOverflow上找到一个类似的问题: https://