RubyMotion, Android and NDKs

Hi Everyone

I stumbled on RubyMotion during a late night search on the weekend and I thought wow, this may be fun. So, I hooked up a starter version and began messing around. I started with the Android Hello World and it would not compile - same thing as another thread (The Android NDK blah blah).

So, I downloaded a newer NDK from https://dl.google.com/android/repository/android-ndk-r19c-darwin-x86_64.zip and placed the resulting files in ~/.rubymotion-android/ and renamed what was there to ndk-old. This took me a lot further. To a new error:

clang: error: no such file or directory: ‘./build/Development-28/obj/local/armeabi-v7a/Users/macbookdev/Hello/app/main_activity.rb.armv7.o.s’
clang: error: no input files

I really like the feel of RubyMotion and I would love to get somewhere with it (even if that somewhere is to realize I should not be writing apps :smile:). Does anyone have any idea what my next step should be?

You’ll find lots more people and more information in the motioneers.herokuspp.com Slack #android channel. The short answer is that API 28 has major structural changes to the NDK tooling causing problems for RM, so you’ll have to use 27 for now.

You can also sign up for RubyMotionweekly.com

1 Like

Cool thanks. I joined that Slack place (after I discovered your link was a typo). That place will take some getting used to. I did change everything I could to 27 and then got a new compile error:

./build/Development-27/java/com/yourcompany/hello/MainActivity.java:5: cannot access android.app.Activity
bad class file: android/app/Activity.class(android/app:Activity.class)
class file has wrong version 52.0, should be 50.0
Please remove or make sure it appears in the correct subdirectory of the classpath.
public class MainActivity extends android.app.Activity {
^
rake aborted!

Your best bet right now is blow away the ~/.rubymotion-android directory and then run motion android-setup. After that if you use API 27 you shouldn’t have any problems.

That is exactly what I was thinking Aaron but wanted to check if that was ok. Great idea. Let me do it tomorrow. Thanks Bud.

Well - tried that but the same error:

./build/Development-27/java/com/yourcompany/hello/MainActivity.java:5: cannot access android.app.Activity
bad class file: android/app/Activity.class(android/app:Activity.class)
class file has wrong version 52.0, should be 50.0
Please remove or make sure it appears in the correct subdirectory of the classpath.
public class MainActivity extends android.app.Activity {
                                             ^
rake aborted!

SOLVED:

For the next person that stumbles here. So, it turns out that the JDK needed to be updated and just so we are clear, Oracle requires an account and signing in for this. But I got the jdk-8u211 and that made the difference - I made the mistake of assuming that updating my Java to v8 would do the same for the JDK. It did not. I feel stupid. And sometimes, she feels me.