NoSuchMethodError getChildFragmentManager()

可紊 提交于 2019-12-03 11:06:21

问题


I'm trying to implement a ViewPager with a FragmentPagerAdapter, where the ViewPager itself is located inside a fragment. I've read in the docs that it should be possible with the newest Support Library and by using nested fragments. Principally I would like the PagerAdapter to use the root fragment's child fragment manager.

So, my project uses ActionBarSherlock and SherlockFragments. As the support lib bundled with ActionBarSherlock didn't include the method getChildFragmentManager() at all, I downloaded the newest support library v4 and placed it in the libs folder of ActionBarSherlock and my project, too. With this change the project compiles okay, but at first run it exits with a NoSuchMethodError regarding getChildFragmentManager(). What am I doing wrong here?

(P.s. I'm testing it with Android 2.2 which is my targeted minimum platform.)

Thanks!

SOLVED: I replaced the support library in my project and in all referenced libraries with the latest version. Then I cleaned my project, however I forgot to clean and rebuild the referenced libraries, too... This led to this peculiar behaviour.


回答1:


Make sure that none of your referenced libraries use Support Library v13. If you do only the v13 library will be used in all your projects referencing the one using v13 and this seems to interfere with the getChildFragmentManager() method. See THIS QUESTION for more info and pay attention to the console print out when doing a Project->Clean on your whole workspace (assuming you are using Eclipse).

I had the same issue as you but it got resolved once I had the v13 library removed from one of the five Libraries referenced.




回答2:


The only way to fix this, is just updating ActionBarSherlock with the last android-support-v4 library, wich is 19.1. You can get it uploading it from Android Manager. After that recompile the apk with this change and you will get the method.




回答3:


SOLVED: I replaced the support library in my project and in all referenced libraries with the latest version. Then I cleaned my project, however I forgot to clean and rebuild the referenced libraries, too... This led to this peculiar behaviour.



来源:https://stackoverflow.com/questions/14378366/nosuchmethoderror-getchildfragmentmanager

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!