HipByte / Flow

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

undefined method supportActionBar for MainActivity #33

Open andrewhavens opened 8 years ago

andrewhavens commented 8 years ago

It seems that the UI::Navigation class is not compatible with whatever version of Android I am using (23?). When I try to set the title that is displayed in the navigation bar, I see this error:

Exception raised: NoMethodError: undefined method `supportActionBar' for #<MainActivity:0x100075>

I noticed that the main activity class generated by the Flow generator looks like this:

class MainActivity < Android::App::Activity

I was able to get it to work with this:

class MainActivity < Android::Support::V7::App::AppCompatActivity

But I'm not sure if that is the right solution to this problem.

wndxlori commented 7 years ago

I just ran into this same problem. Same fix that @andrewhavens recommended above worked for me, but it seems like there should be a more appropriate bug fix applied to Flow

lrz commented 7 years ago

This looks like a bug in the template generator indeed, which should use the AppCompat subclass. @andrewhavens as you're a contributor feel free to patch https://github.com/HipByte/Flow/blob/master/template/flow/files/app/android/main_activity.rb#L1 accordingly :-)