#Two Gotcha's In the @RubyMotion getting started guide for Android
##The NDK Does not Support API level L
I got this error when I tried to rake device
for the first time.
ERROR! It looks like your version of the NDK does not support API level L. Switch to │ 7 structure: Structure
a lower API level or install a more recent NDK.
luckily, there's an easy fix.
- Go to the NDK index and download the "64 bit, 64 Target link" for MacOs. You should have used the "64bit, 32bit target" if you were following the instructions in the getting started. Because of size limitations, they hid the Android L headers in the 64 Bit version, so we're just going to steal them!
- Once that is downloaded, unzip the new NDK and navigate to
/platforms
. You should see the Android-L folder there. - Copy that Android L folder into the local NDK directory (if you followed the example in the guide, it will be
~/android-rubymotion/ndk/platforms/
)
That's it! Your NDK now knows how to read the new and shiny version of android.
(Many Thanks to @MarkVillaCampa for tweeting about this earlier!)
Then I got this error.
ERROR! Cannot install an app built for API version L on a device running API version 19
Apparently, the generator defaults to targeting the latest version of Android, and there are no phones that come stocked with L yet. No worries!
- Make sure you've got all the SDK's downloaded that you want to work with. The Getting started guide goes over that here.
- navigate to and open the Rakefile in your project.
- in the
Motion::Project::App.setup
block, assign theapi_version
attribute on theapp
object, like so:
```
Motion::Project::App.setup do |app|
app.name = "MyAndroidMotionApp"
app.api_version = "19"
end
```
Where '19' is the SDK of the device you are targeting.[1]
- run
rake device
and see your app boot up on the phone. Congrats!
You can see what else you can configure by running rake config
, which provides lots of neat options.
Good luck, Robots!
[1] Go here to compare numbers to version names.
Thanks so much!
The NDK issue is problematic, in the past L headers used to be part of the package. We will have a look and see how we can support L automatically.
The second issue is less an "issue": by default RubyMotion will target the latest version of Android it supports (here being L), so your device has to run L. Maybe it would be better to only target the latest stable release instead?