Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

getChildFragmentManager raise NoSuchMethod exception on 4.0.3 device but not on 4.2.2

I need to use nested fragments for my application and so I'd like to use getChildFragmentManager.

I have two devices:

  • A real one running on 4.0.3
  • A virtual one running on 4.2.2

It works pretty well on the second one but not on my physical device since the call to this method raise a NoSuchMethod exception.

07-10 19:53:51.722: E/AndroidRuntime(29711): java.lang.NoSuchMethodError: fr.epitech.test_esi.fragments.ReservationCalendarFragment.getChildFragmentManager

My project use a referenced library so I have downloaded the latest android support library (from SDK manager) and I have added it to both the library and the main project.

Projects view in Eclipse

Also I decided to set the minimum sdk version supported to 4.0.3 (the version my real device is running on):

<uses-sdk
    android:minSdkVersion="15"
    android:targetSdkVersion="17" />

For both the main project and library.

If anyone has an idea of what I could do wrong, let me know.

like image 866
nathan Avatar asked Jul 10 '13 18:07

nathan


1 Answers

getChildFragmentManager() is only available via the Android Support package's backport of fragments, or on API Level 17+ for native fragments. Hence, if you are trying to use native fragments on API Level 15 or 16, and you are also trying to use getChildFragmentManager(), you will get this error.

like image 93
CommonsWare Avatar answered Sep 20 '22 10:09

CommonsWare