问题
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!
回答1:
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)
回答2:
I had the same issue. The file date on the one in my project was 9/13 and the one in my /extras/android/support/v4/ directory was 7/13. Replacing the file fixed my issues.
来源:https://stackoverflow.com/questions/15805574/android-support-v4-app-fragment-undefined-method-getchildfragmentmanager