run command cucumber version fail ,

253 Views Asked by At

I try to work with cucumber / calabash-android , but I face a problem Unable to activate calabash-android-0.9.2, because json-2.1.0 conflicts with json (~> 1.8) ? , I tried to unistall cucmber and install it .enter image description here

2

There are 2 best solutions below

0
jmoody On

Calabash Android and iOS do not support json 2.1 - they are pinned to json 1.8.

If your ruby does not support json 1.8, you should downgrade to ruby 2.3.x.

0
kubano On

The most recommended Ruby version for using Calabash gems is still the v2.3.1. As I see, you use rbenv. That's nice, install that version and set as global default:

rbenv install 2.3.1
rbenv global 2.3.1
eval "$(rbenv init -)"

Use bundler to determine which gem versions you want to use in Ruby projects. Install bundler:

gem install bundler

Make a Gemfile with the following contents:
(You can create a skeleton with the bundler init command too.)

source "https://rubygems.org"

gem 'calabash-android', '~> 0.9.2'
gem 'calabash-cucumber', '~> 0.21.4'
gem 'cucumber', '~> 2.4'
gem 'json', '~> 1.8.6', '< 2.0'

Install the specified gems with bundler (if you change Gemfile, you have to run again):

bundle install

Run Ruby project with this configuration:

bundle exec calabash-android run myApp.apk

Small explanation for Gemfile:

  • ~> relation allows minor updates only
  • >= means you will get major updates too
  • or you can define a version exactly: gem 'json', '1.8.6'

The json 1.8.6 is the latest version which works for me.

https://rubygems.org/gems/json/versions