rubymotion-community / motion-support

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

Android support? #36

Open rafaeliga opened 8 years ago

rafaeliga commented 8 years ago

Hello,

Is there any chance of this gem get Android support?

Or any alternatives for "cattr_accessor", for example?

Thanks,

tkadauke commented 8 years ago

I don't have an Android device, so I'm not sure how much I can help you. What exactly is the problem when you use motion-support with Android? Off the top of my head, not a lot should be incompatible with Android.

You should be able to cherry-pick what you want from motion-support. cattr_accessor can be used via:

require 'motion-support/core_ext/class'

See the readme for details. Let me know if that works for you.

rafaeliga commented 8 years ago

I see, Im going to try to require only "cattr_accessor", but the error that Im getting is this one:

error: Helper has private access in EditorCompat public class Callback extends java.lang.Object implements com.android.internal.util.Predicate, android.support.v4.content.SharedPreferencesCompat.EditorCompat.Helper, com.android.volley.RequestQueue.RequestFilter {

You can see that Im using Volley for network requests, I'll try to remove Volley to see if that is the issue too, thanks.

rafaeliga commented 8 years ago

Gemfile:

gem 'motion-support', require: false

Then I added to Rakefile:

require 'motion-support/core_ext/class'

The error that I got is:

Exception raised: NoMethodError: undefined method extract_options!' for [:manager]:Array 08-18 18:01:18.999 22129 22129 E br/com/rubythree/hello: from attribute_accessors.rb:31 incattr_reader' 08-18 18:01:18.999 22129 22129 E br/com/rubythree/hello: from attribute_accessors.rb:165 in cattr_accessor' 08-18 18:01:18.999 22129 22129 E br/com/rubythree/hello: from user_manager.rb:3 inrb_scope2' 08-18 18:01:18.999 22129 22129 E br/com/rubythree/hello: from user_manager.rb:1 in `rb_scope1'

I see that extract_options is a method from Array, then I added to Rakefile:

require 'motion-support/core_ext/array'

and I get the error:

Exception raised: NoMethodError: undefined method class_exec' for UserManager:java.lang.Class 08-18 18:04:05.738 23007 23007 E br/com/rubythree/hello: from attribute_accessors.rb:34 inblock in cattr_reader' 08-18 18:04:05.738 23007 23007 E br/com/rubythree/hello: from attribute_accessors.rb:32 in cattr_reader' 08-18 18:04:05.738 23007 23007 E br/com/rubythree/hello: from attribute_accessors.rb:165 incattr_accessor' 08-18 18:04:05.738 23007 23007 E br/com/rubythree/hello: from user_manager.rb:3 in rb_scope2' 08-18 18:04:05.738 23007 23007 E br/com/rubythree/hello: from user_manager.rb:1 inrb_scope1' 08-18 18:04:05.738 23007 23007 E br/com/rubythree/hello: Uncaught exception when initializing `user_manager.rb.armv7.o' scope -- aborting

and now I dont know whats the next to include :D