GetChildFragmentManager throws a NoSuchMethod exception on device 4.0.3 but not 4.2.2

I need to use nested fragments for my application, so I would like to use getChildFragmentManager .

I have two devices:

  • Real running on 4.0.3
  • Virtual running on 4.2.2

This works well on the second, but not on my physical device, since calling this method throws a NoSuchMethod exception.

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

My project uses a reference library, so I downloaded the latest Android support library (from the SDK manager) and I added it to both the library and the main project.

Projects view in Eclipse

I also decided to install the minimum version of sdk, supported by 4.0.3 (the version on which my real device works):

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

For the main project and library.

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

+6
source share
2 answers

getChildFragmentManager() is only available through the Android Support backport snippets or at the API level 17+ for custom snippets. Therefore, if you try to use your own fragments at API level 15 or 16, and you also try to use getChildFragmentManager() , you will get this error.

+10
source

try using android.support.v4.app.Fragment instead

0
source

Source: https://habr.com/ru/post/949149/


All Articles