motion-gradle allows RubyMotion projects to integrate with Gradle to manage your dependencies.
You need to have gradle installed:
$ brew install gradle
And the gem installed:
$ [sudo] gem install motion-gradle
Or if you use Bundler:
gem 'motion-gradle'
You also need to install Extras/Local Maven repository for Support Libraries
, Extras/Android Support Repository
and Extras/Google Repository
with the Android SDK Manager gui.
Then, add the following lines to your ~/.profile file
export ANDROID_HOME=~/.rubymotion-android/sdk
(ANDROID_HOME
should have same value with RUBYMOTION_ANDROID_SDK
)
Edit the Rakefile
of your RubyMotion project and add the following require lines:
require 'rubygems'
require 'motion-gradle'
From version 1.1.0 you can use the same gradle dependency string that Java users use.
Motion::Project::App.setup do |app|
# ...
app.gradle do
dependency 'net.sf.ehcache:ehcache:2.9.0'
dependency 'com.joanzapata.pdfview:android-pdfview:1.0.+@aar'
dependency 'com.danikula:videocache:2.3.1' do
exclude module: 'android', group: 'com.google.android'
end
end
end
If the gradle
command is not found in your PATH, you can configure it:
Motion::Project::App.setup do |app|
# ...
app.gradle.path = '/some/path/gradle'
end
Motion::Project::App.setup do |app|
# ...
app.gradle do
repository 'https://bintray.com/bintray/jcenter'
repository 'http://dl.bintray.com/austintaylor/gradle'
end
end
Motion::Project::App.setup do |app|
# ...
app.gradle do
library 'mylib', path: '/Users/joffreyjaffeux/Projects/mylib'
end
end
If relative path is used it's relative to your Rakefile, if you don't specify a path it will search in your_app/my_lib.
Motion::Project::App.setup do |app|
# ...
app.gradle do
plugin 'com.google.gms.google-services'
end
end
Motion::Project::App.setup do |app|
# ...
app.gradle do
classpath 'com.google.gms:google-services:1.3.0-beta1'
end
end
Motion::Project::App.setup do |app|
# ...
app.gradle do
aidl 'com.android.vending.billing', './vendor/IInAppBillingService.aidl'
end
end
To tell motion-gradle to download your dependencies, run the following rake task:
$ [bundle exec] rake gradle:install
After a rake clean:all
you will need to run the install task agin.
That’s all.
- Clunky .aar support, if you can provide failing cases of libs using .aar it would be great
- Issue with iconify : http://hipbyte.myjetbrains.com/youtrack/issue/RM-867