rubymotion-community / motion-support

Commonly useful extensions to the standard library for RubyMotion
MIT License
132 stars 28 forks source link

hash with indifferent access fails with undefined method_defined? on Android #43

Open davetrollope-fsml opened 5 years ago

davetrollope-fsml commented 5 years ago

Using @wndxlori PR https://github.com/rubymotion/motion-support/pull/42 to resolve relative path issues, I get the following error when requiring motion-support/core_ext on a brand new project:

03-31 17:52:38.106 2099 2099 E com/yourcompany/hello: Exception raised: NoMethodError: undefined method method_defined?' for Class:Class 03-31 17:52:38.108 2099 2099 E com/yourcompany/hello: from /Users/davetrollope/.gems/bundler/gems/motion-support-3fedd0920d88/motion/hash_with_indifferent_acc 03-31 17:52:38.108 2099 2099 E com/yourcompany/hello: from /Users/davetrollope/.gems/bundler/gems/motion-support-3fedd0920d88/motion/hash_with_indifferent_acc 03-31 17:52:38.110 2099 2099 E com/yourcompany/hello: Uncaught exception when initializinghash_with_indifferent_access.rb.x86.o' scope -- aborting --------- beginning of crash 03-31 17:52:38.114 2099 2099 E AndroidRuntime: FATAL EXCEPTION: main 03-31 17:52:38.114 2099 2099 E AndroidRuntime: Process: com.yourcompany.hello, PID: 2099 03-31 17:52:38.114 2099 2099 E AndroidRuntime: java.lang.UnsatisfiedLinkError: JNI_ERR returned from JNI_OnLoad in "/data/app/com.yourcompany.hello-uxty06nv7-kMBV1yHlleMg==/lib/x86/libpayload.so" 03-31 17:52:38.114 2099 2099 E AndroidRuntime: at java.lang.Runtime.loadLibrary0(Runtime.java:1016) 03-31 17:52:38.114 2099 2099 E AndroidRuntime: at java.lang.System.loadLibrary(System.java:1657) 03-31 17:52:38.114 2099 2099 E AndroidRuntime: at com.yourcompany.hello.MainActivity.(MainActivity.java:10) 03-31 17:52:38.114 2099 2099 E AndroidRuntime: at java.lang.Class.newInstance(Native Method) 03-31 17:52:38.114 2099 2099 E AndroidRuntime: at android.app.Instrumentation.newActivity(Instrumentation.java:1173) 03-31 17:52:38.114 2099 2099 E AndroidRuntime: at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2708) 03-31 17:52:38.114 2099 2099 E AndroidRuntime: at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2892) 03-31 17:52:38.114 2099 2099 E AndroidRuntime: at android.app.ActivityThread.-wrap11(Unknown Source:0) 03-31 17:52:38.114 2099 2099 E AndroidRuntime: at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1593) 03-31 17:52:38.114 2099 2099 E AndroidRuntime: at android.os.Handler.dispatchMessage(Handler.java:105) 03-31 17:52:38.114 2099 2099 E AndroidRuntime: at android.os.Looper.loop(Looper.java:164) 03-31 17:52:38.114 2099 2099 E AndroidRuntime: at android.app.ActivityThread.main(ActivityThread.java:6541) 03-31 17:52:38.114 2099 2099 E AndroidRuntime: at java.lang.reflect.Method.invoke(Native Method) 03-31 17:52:38.114 2099 2099 E AndroidRuntime: at com.android.internal.os.Zygote$MethodAndArgsCaller.run(Zygote.java:240) 03-31 17:52:38.114 2099 2099 E AndroidRuntime: at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:767)

Steps: create a new project: motion create --template=android Hello Add to Gemfile: gem 'motion-support', git: 'https://github.com/wndxlori/motion-support.git', ref: '3fedd09', require: false Add to Rakefile: require 'motion-support/core_ext' Then run bundle and bundle exec rake motion --version: 5.17 on mohave

andrewhavens commented 5 years ago

This gem was originally written prior to RubyMotion Android support, but we can work towards adding Android support.