如何在OS X上启动calabash-android? (Ruby gems依赖错误)

时间:2017-05-12 11:01:58

标签: ruby rubygems calabash calabash-android

我已经通过calabash-android gen

成功生成了文件树

之后我试图运行测试:

calabash-android run ../app/build/outputs/apk/app-debug.apk 

但得到了错误:

Unable to activate calabash-android-0.9.0, because json-2.0.2 conflicts with json (~> 1.8) (Gem::ConflictError)

我通过gem install 'json' -v 1.8.6

安装了json 1.8.6

现在宝石列表json输出我

*** LOCAL GEMS ***

json (default: 2.0.2, 1.8.6)
multi_json (1.12.1)

但错误Unable to activate calabash-android-0.9.0, because json-2.0.2 conflicts with json (~> 1.8) (Gem::ConflictError)再次抛出。哪里错了?

UPD

我试图解决这里描述的问题github.com/calabash/calabash-ios/issues/1260但是osx说我不能删除2.0.2版本,因为它是默认的

MacBook-Pro-MacBook:calabash zub3r$ gem uninstall -Vax --force --no-abort-on-dependent json
ERROR:  While executing gem ... (Gem::InstallError)
    json is not installed in GEM_HOME, try:
    gem uninstall -i /Users/zub3r/.rvm/gems/ruby-2.4.0@global json
MacBook-Pro-MacBook:calabash zub3r$ gem uninstall -i /Users/zub3r/.rvm/gems/ruby-2.4.0@global json

You have requested to uninstall the gem:
    json-1.8.6

calabash-android-0.9.0 depends on json (~> 1.8)
cucumber-1.3.20 depends on json (~> 1.7, development)
luffa-2.0.0 depends on json (~> 1.8)
If you remove this gem, these dependencies will not be met.
Continue with Uninstall? [yN]  ^CERROR:  Interrupted
MacBook-Pro-MacBook:calabash zub3r$ gem uninstall -i /Users/zub3r/.rvm/gems/ruby-2.4.0@global json --version 2.0.2
ERROR:  While executing gem ... (Gem::InstallError)
    gem "json" cannot be uninstalled because it is a default gem

2 个答案:

答案 0 :(得分:2)

使用bundler

解决了问题
bundle init

Gemfile内容替换为

# frozen_string_literal: true
source "https://rubygems.org"

gem 'calabash-android'

然后

bundle install

答案 1 :(得分:0)

我遇到了同样的问题,我降级了我的红宝石版本并得到了解决。 请找到下面的解决方案

$ gem -v
2.0.3
$ gem list rubygems-update
$ gem uninstall -v 2.0.3 rubygems-update 

$ gem install -v 1.8.24 rubygems-update
$ update_rubygems
$ gem -v

1.8.24