android.support.v4.app.Fragment: undefined method getChildFragmentManager()

blub picture blub · Apr 4, 2013 · Viewed 12.6k times · Source

I'm using ActionBarSherlock and ViewPageIndicator and I tried to implement nested fragments, but the method getChildFragmentManager() is undefined in myandroid.support.v4.app.Fragments.

There are no other errors and ABS and VPI work as expected.

I'm not using the Support Library v13, I'm on the latest versions and I've cleaned my projects. A normal android.app.Fragment does not complain about getChildFragmentManager().

I also tried rearranging the support library dependencies (android-support-v4.jar in ABS, VPI and main project referencing it, or android-support-v4.jar in as external jar), but getChildFragmentManager() remains undefined.

If I remove the VPI though, getChildFragmentManager() works, but of course VPI stops working. So, there must be something wrong with the dependencies, but I'm running out of ideas to try.

Any help would be much appreciated!

Answer

Dodge picture Dodge · Apr 4, 2013

i had some similar issues with the support library because of diffrent versions in ABS and in my project (but not using VPI)

try to download the latest android-support-v4.jar with the Android SDK Manager and then copy the jar from <sdkdir>/extras/android/support/v4/android-support-v4.jar to your project and also to ABS and VPI (afaik both have a older copy of android-support-v4.jar in thier download)