nucleartux / react-native-date

React Native date and time pickers for Android
MIT License
47 stars 20 forks source link

Compilation Error #3

Closed viveksatasiya closed 9 years ago

viveksatasiya commented 9 years ago

When I try to run sudo react-native run-android command after adding all dependancies to project, I get following error:

/home/upc3/rnd/projects/react-native/Qmantic/android/app/src/main/java/com/qmantic/MainActivity.java:32: error: constructor ReactDatePackage in class ReactDatePackage cannot be applied to given types;
                .addPackage(new ReactDatePackage(this))
                            ^
  required: FragmentActivity
  found: MainActivity
  reason: actual argument MainActivity cannot be converted to FragmentActivity by method invocation conversion
1 error
:app:compileDebugJavaWithJavac FAILED

What I am missing?? Please hele me. Thanks

nucleartux commented 9 years ago

You forgot change extend block in your application activity class from FragmentActivity, not from Activity. Add this line at top of MainActivity.java: import android.support.v4.app.FragmentActivity; And replace extends to: public class MainActivity extends FragmentActivity

viveksatasiya commented 9 years ago

sorry it was my mistake. I forgot to add dependency. Thanks a lot.