HipByte / Flow

Cross-platform libraries for RubyMotion
BSD 2-Clause "Simplified" License
141 stars 29 forks source link

[Android] NoMethodError: undefined method `width=' for #<View:0x55> #21

Closed Watson1978 closed 8 years ago

Watson1978 commented 8 years ago

With latest codes in master branch, when run "samples/ui_demo" on Android emulator, then I get this error.

[master][~/prj/Flow/samples/ui_demo]$ rake android:emulator
   Install build/android/Development-23/uiapp.apk
     Start com.yourcompany.uiapp/.MainActivity
--------- beginning of main
--------- beginning of system
06-22 02:40:29.103  2469  2469 E com/yourcompany/uiapp: Exception raised: NoMethodError: undefined method `width=' for #<View:0x55>
06-22 02:40:29.103  2469  2469 E com/yourcompany/uiapp:     from screen.rb:113 in `view'
06-22 02:40:29.103  2469  2469 E com/yourcompany/uiapp:     from screen.rb:92 in `before_on_load'
06-22 02:40:29.103  2469  2469 E com/yourcompany/uiapp:     from screen.rb:8 in `onCreateView'
--------- beginning of crash
Watson1978 commented 8 years ago

dumped defined methods with p view.methods at screen.rb:113

06-22 05:59:55.231  2717  2717 I com/yourcompany/uiapp: [:!, :!=, :!~, :"<init>", :==, :===, :=~, :__dump_reference_tables__, :__id__, :__send__, :_apply_layout, :_autolayout_when_resized=, :add_child, :alpha, :alpha=, :background_color, :background_color=, :block_given?, :class, :clone, :define_singleton_method, :delete_child, :dup, :enum_for, :eql?, :equal?, :equals, :exit, :extend, :finalize, :format, :getClass, :hash, :hashCode, :hidden=, :hidden?, :initialize, :inspect, :instance_eval, :instance_of?, :instance_variable_defined?, :instance_variable_get, :instance_variable_set, :instance_variables, :internalClone, :is_a?, :iterator?, :kind_of?, :lambda, :loop, :method_missing, :methods, :nil?, :notify, :notifyAll, :object_id, :p, :print, :proc, :proxy, :puts, :raise, :rand, :respond_to?, :send, :set_vm_debug_logs, :sleep, :sprintf, :tap, :toString, :to_enum, :to_json, :to_s, :update_layout, :wait]

Looks like UI::View object in Android actually does not have width= which method should be defined in CSSNode at css_node.c

jjaffeux commented 8 years ago

@Watson1978 looks like it doesn't have any of the css_node methods

anything wrong in https://github.com/HipByte/Flow/blob/master/Rakefile#L52 ? or broken by the last RM ?

Watson1978 commented 8 years ago

Looks like Init_CSSNode in css_node.c would be called at launching and defined CSSNode and methods at least.

However, when use UI::View, looks like it inherits empty class.

Looks for me this is similar with #19