Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Android: Documentation improvement for fresh starters #116

Open
dagosi opened this issue Dec 11, 2018 · 3 comments

Comments

Projects
None yet
5 participants
@dagosi
Copy link

commented Dec 11, 2018

I recently started using RubyMotion, and it was't as easy as the documentation stated. I had to make use of the Slack channel to ask for help, and Amir jumped to the rescue.

I was getting this error:

$ rake emulator
   Create ./build/Development-23/AndroidManifest.xml
  Compile ./app/main_activity.rb
clang: error: no such file or directory: './build/Development-23/obj/local/x86/Users/daniel/code/motion/Hello/app/main_activity.rb.x86.o.s'
clang: error: no input files
#<Thread:0x00007fe001127ad0@/Library/RubyMotion/lib/motion/project/parallel_builder.rb:43 run> terminated with exception (report_on_exception is true):
Traceback (most recent call last):
   3: from /Library/RubyMotion/lib/motion/project/parallel_builder.rb:47:in `block (2 levels) in initialize'
   2: from /Library/RubyMotion/lib/motion/project/template/android.rb:246:in `block (3 levels) in <top (required)>'
   1: from /Users/daniel/.rvm/gems/ruby-2.5.0@motion-hello/gems/rake-12.3.1/lib/rake/file_utils.rb:57:in `sh'
/Users/daniel/.rvm/gems/ruby-2.5.0@motion-hello/gems/rake-12.3.1/lib/rake/file_utils.rb:67:in `block in create_shell_runner': Command failed with status (1): [/Users/daniel/.rubymotion-android/ndk/tool...] (RuntimeError)
rake aborted!
Command failed with status (1): [/Users/daniel/.rubymotion-android/ndk/tool...]
/Library/RubyMotion/lib/motion/project/template/android.rb:246:in `block (3 levels) in <top (required)>'
/Library/RubyMotion/lib/motion/project/parallel_builder.rb:47:in `block (2 levels) in initialize'
Tasks: TOP => build
(See full trace by running task with --trace)

As you can see, it does not say very well what the issue was (well... a non-existent directory/file, but why?) Not to mentioned that I followed step by step the tutorial on the website.

After battling with Amir on this, he pointed something very interesting out. It seems that the Indie plan on includes the 27 API. This is something that the documentation does not explicitly say, which led me to waste a couple of hours of my time.

Also, I noticed that some other new developers are having the same issue about this. Would be better to have a more detail documentation on this step.

Because Amir was really helpful with me setting things up, I would like help with this if necessary. Please let me know.

@CyrilFind

This comment has been minimized.

Copy link

commented Dec 13, 2018

I am also discovering RubyMotion, but with an old project I'm picking up and trying to build, and the error messages were not very clear too:

▶ bundle exec rake emulator --trace
Could not find rake-10.4.2 in any of the sources
Run `bundle install` to install missing gems.
** Invoke emulator (first_time)
** Invoke emulator:build (first_time)
** Execute emulator:build
** Invoke build (first_time)
** Execute build
mkdir -p ./build/Development-22
mkdir -p ./build/Development-22/java/com/adler/geologic
"/Library/RubyMotion/bin/android/gen_bridge_metadata" -o "./build/Development-22/android-support-v4.jar.bridgesupport"  "vendor/android-support-v4.jar"
Could not find rake-10.4.2 in any of the sources
Run `bundle install` to install missing gems.
rake aborted!
Command failed with status (7): ["/Library/RubyMotion/bin/android/gen_bridg...]
/Users/Cyril/Projects/Adler/geologic-android/vendor/bundle/ruby/2.5.0/gems/rake-10.4.2/lib/rake/file_utils.rb:66:in `block in create_shell_runner'
/Users/Cyril/Projects/Adler/geologic-android/vendor/bundle/ruby/2.5.0/gems/rake-10.4.2/lib/rake/file_utils.rb:57:in `sh'
/Users/Cyril/Projects/Adler/geologic-android/vendor/bundle/ruby/2.5.0/gems/rake-10.4.2/lib/rake/file_utils_ext.rb:37:in `sh'
/Library/RubyMotion/lib/motion/project/template/android/config.rb:454:in `block in vendored_bs_files'
/Library/RubyMotion/lib/motion/project/template/android/config.rb:443:in `map'
/Library/RubyMotion/lib/motion/project/template/android/config.rb:443:in `vendored_bs_files'
/Library/RubyMotion/lib/motion/project/template/android.rb:223:in `block (2 levels) in <top (required)>'
/Library/RubyMotion/lib/motion/project/template/android.rb:219:in `each'
/Library/RubyMotion/lib/motion/project/template/android.rb:219:in `block in <top (required)>'
/Users/Cyril/Projects/Adler/geologic-android/vendor/bundle/ruby/2.5.0/gems/rake-10.4.2/lib/rake/task.rb:240:in `block in execute'
/Users/Cyril/Projects/Adler/geologic-android/vendor/bundle/ruby/2.5.0/gems/rake-10.4.2/lib/rake/task.rb:235:in `each'
/Users/Cyril/Projects/Adler/geologic-android/vendor/bundle/ruby/2.5.0/gems/rake-10.4.2/lib/rake/task.rb:235:in `execute'
/Users/Cyril/Projects/Adler/geologic-android/vendor/bundle/ruby/2.5.0/gems/rake-10.4.2/lib/rake/task.rb:179:in `block in invoke_with_call_chain'
/Users/Cyril/.rvm/rubies/ruby-2.5.0/lib/ruby/2.5.0/monitor.rb:226:in `mon_synchronize'
/Users/Cyril/Projects/Adler/geologic-android/vendor/bundle/ruby/2.5.0/gems/rake-10.4.2/lib/rake/task.rb:172:in `invoke_with_call_chain'
/Users/Cyril/Projects/Adler/geologic-android/vendor/bundle/ruby/2.5.0/gems/rake-10.4.2/lib/rake/task.rb:165:in `invoke'
/Library/RubyMotion/lib/motion/project/template/android.rb:824:in `block (2 levels) in <top (required)>'
/Users/Cyril/Projects/Adler/geologic-android/vendor/bundle/ruby/2.5.0/gems/rake-10.4.2/lib/rake/task.rb:240:in `block in execute'
/Users/Cyril/Projects/Adler/geologic-android/vendor/bundle/ruby/2.5.0/gems/rake-10.4.2/lib/rake/task.rb:235:in `each'
/Users/Cyril/Projects/Adler/geologic-android/vendor/bundle/ruby/2.5.0/gems/rake-10.4.2/lib/rake/task.rb:235:in `execute'
/Users/Cyril/Projects/Adler/geologic-android/vendor/bundle/ruby/2.5.0/gems/rake-10.4.2/lib/rake/task.rb:179:in `block in invoke_with_call_chain'
/Users/Cyril/.rvm/rubies/ruby-2.5.0/lib/ruby/2.5.0/monitor.rb:226:in `mon_synchronize'
/Users/Cyril/Projects/Adler/geologic-android/vendor/bundle/ruby/2.5.0/gems/rake-10.4.2/lib/rake/task.rb:172:in `invoke_with_call_chain'
/Users/Cyril/Projects/Adler/geologic-android/vendor/bundle/ruby/2.5.0/gems/rake-10.4.2/lib/rake/task.rb:201:in `block in invoke_prerequisites'
/Users/Cyril/Projects/Adler/geologic-android/vendor/bundle/ruby/2.5.0/gems/rake-10.4.2/lib/rake/task.rb:199:in `each'
/Users/Cyril/Projects/Adler/geologic-android/vendor/bundle/ruby/2.5.0/gems/rake-10.4.2/lib/rake/task.rb:199:in `invoke_prerequisites'
/Users/Cyril/Projects/Adler/geologic-android/vendor/bundle/ruby/2.5.0/gems/rake-10.4.2/lib/rake/task.rb:178:in `block in invoke_with_call_chain'
/Users/Cyril/.rvm/rubies/ruby-2.5.0/lib/ruby/2.5.0/monitor.rb:226:in `mon_synchronize'
/Users/Cyril/Projects/Adler/geologic-android/vendor/bundle/ruby/2.5.0/gems/rake-10.4.2/lib/rake/task.rb:172:in `invoke_with_call_chain'
/Users/Cyril/Projects/Adler/geologic-android/vendor/bundle/ruby/2.5.0/gems/rake-10.4.2/lib/rake/task.rb:165:in `invoke'
/Users/Cyril/Projects/Adler/geologic-android/vendor/bundle/ruby/2.5.0/gems/rake-10.4.2/lib/rake/application.rb:150:in `invoke_task'
/Users/Cyril/Projects/Adler/geologic-android/vendor/bundle/ruby/2.5.0/gems/rake-10.4.2/lib/rake/application.rb:106:in `block (2 levels) in top_level'
/Users/Cyril/Projects/Adler/geologic-android/vendor/bundle/ruby/2.5.0/gems/rake-10.4.2/lib/rake/application.rb:106:in `each'
/Users/Cyril/Projects/Adler/geologic-android/vendor/bundle/ruby/2.5.0/gems/rake-10.4.2/lib/rake/application.rb:106:in `block in top_level'
/Users/Cyril/Projects/Adler/geologic-android/vendor/bundle/ruby/2.5.0/gems/rake-10.4.2/lib/rake/application.rb:115:in `run_with_threads'
/Users/Cyril/Projects/Adler/geologic-android/vendor/bundle/ruby/2.5.0/gems/rake-10.4.2/lib/rake/application.rb:100:in `top_level'
/Users/Cyril/Projects/Adler/geologic-android/vendor/bundle/ruby/2.5.0/gems/rake-10.4.2/lib/rake/application.rb:78:in `block in run'
/Users/Cyril/Projects/Adler/geologic-android/vendor/bundle/ruby/2.5.0/gems/rake-10.4.2/lib/rake/application.rb:176:in `standard_exception_handling'
/Users/Cyril/Projects/Adler/geologic-android/vendor/bundle/ruby/2.5.0/gems/rake-10.4.2/lib/rake/application.rb:75:in `run'
/Users/Cyril/Projects/Adler/geologic-android/vendor/bundle/ruby/2.5.0/gems/rake-10.4.2/bin/rake:33:in `<top (required)>'
/Users/Cyril/Projects/Adler/geologic-android/vendor/bundle/ruby/2.5.0/bin/rake:23:in `load'
/Users/Cyril/Projects/Adler/geologic-android/vendor/bundle/ruby/2.5.0/bin/rake:23:in `<top (required)>'
/Users/Cyril/.rvm/gems/ruby-2.5.0/gems/bundler-1.17.1/lib/bundler/cli/exec.rb:74:in `load'
/Users/Cyril/.rvm/gems/ruby-2.5.0/gems/bundler-1.17.1/lib/bundler/cli/exec.rb:74:in `kernel_load'
/Users/Cyril/.rvm/gems/ruby-2.5.0/gems/bundler-1.17.1/lib/bundler/cli/exec.rb:28:in `run'
/Users/Cyril/.rvm/gems/ruby-2.5.0/gems/bundler-1.17.1/lib/bundler/cli.rb:463:in `exec'
/Users/Cyril/.rvm/gems/ruby-2.5.0/gems/bundler-1.17.1/lib/bundler/vendor/thor/lib/thor/command.rb:27:in `run'
/Users/Cyril/.rvm/gems/ruby-2.5.0/gems/bundler-1.17.1/lib/bundler/vendor/thor/lib/thor/invocation.rb:126:in `invoke_command'
/Users/Cyril/.rvm/gems/ruby-2.5.0/gems/bundler-1.17.1/lib/bundler/vendor/thor/lib/thor.rb:387:in `dispatch'
/Users/Cyril/.rvm/gems/ruby-2.5.0/gems/bundler-1.17.1/lib/bundler/cli.rb:27:in `dispatch'
/Users/Cyril/.rvm/gems/ruby-2.5.0/gems/bundler-1.17.1/lib/bundler/vendor/thor/lib/thor/base.rb:466:in `start'
/Users/Cyril/.rvm/gems/ruby-2.5.0/gems/bundler-1.17.1/lib/bundler/cli.rb:18:in `start'
/Users/Cyril/.rvm/gems/ruby-2.5.0/gems/bundler-1.17.1/exe/bundle:30:in `block in <top (required)>'
/Users/Cyril/.rvm/gems/ruby-2.5.0/gems/bundler-1.17.1/lib/bundler/friendly_errors.rb:124:in `with_friendly_errors'
/Users/Cyril/.rvm/gems/ruby-2.5.0/gems/bundler-1.17.1/exe/bundle:22:in `<top (required)>'
/Users/Cyril/.rvm/gems/ruby-2.5.0/bin/bundle:23:in `load'
/Users/Cyril/.rvm/gems/ruby-2.5.0/bin/bundle:23:in `<main>'
Tasks: TOP => build

I have now understood a few things thanks to @amirrajan 😄

First, I had to bump the api_version to one that is actually supported by rubymotion (22 here)

Also, the building step causing problems was the loading of lib jars, so I removed them from the Rakefile:

# -*- coding: utf-8 -*-
$:.unshift("/Library/RubyMotion/lib")
require 'motion/project/template/android'

begin
  require 'bundler'
  Bundler.require
rescue LoadError
end

Motion::Project::App.setup do |app|
  app.name = 'My app'
  app.package = 'com.my.app'
  app.icon = 'logo_icon'
  app.api_version = '22'

# I commented out those:
  app.vendor_project jar: 'vendor/android-support-v4.jar'
  app.vendor_project jar: 'vendor/android-pdfview-1.0.2.jar', native: ["vendor/x86/libvudroid.so", "vendor/armeabi-v7a/libvudroid.so"]
  app.vendor_project jar: 'vendor/volley.jar'
  app.vendor_project jar: 'vendor/httpcore-4.3.3.jar'
  app.vendor_project jar: 'vendor/httpmime-4.3.6.jar'

 # ....

end

Now I have to understand how to load them an other way or to replace their usage by native calls.

At some point, the build was stuck because I had no emulator running (I thought I had typed rake device) but it would be more clear to show a "no emulator" message.

The last thing I still don't understand is the Could not find rake-10.4.2 in any of the sources but it doesn't seem to have any impact on rake actually running 😅

@jeremiahlukus

This comment has been minimized.

Copy link

commented Jan 10, 2019

RubyMotionSetup.pdf

Here is something @wndxlori typed up I grabbed in the slack channel awhile ago.
I am on a new computer so I will edit when I reinstall Andriod. Just dropping this here in the meantime.

@wndxlori

This comment has been minimized.

Copy link
Contributor

commented Jan 11, 2019

That setup was for RailsConf 2017. It was still working early 2018, but I’m certain needs updates now.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.