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.
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.
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.
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.
Related
I have a library and it depends on Android-support-v4 (The JobIntentService class). I'm going to use it in Basic4Android.
There are two ways of adding supprt-v4 dependency to project:
Add <dependsOn>com.android.support:support-v4</dependsOn>
to library xml.
Add
dependsOn>support-annotations</dependsOn>
<dependsOn>support-compat</dependsOn>
<dependsOn>support-v4</dependsOn>
<dependsOn>support-core-ui</dependsOn>
<dependsOn>support-core-utils</dependsOn>
<dependsOn>support-fragment</dependsOn>
<dependsOn>support-media-compat</dependsOn>
to that xml.
If I use the first way, I can't find JobIntentService. If I use the second way it's fine, but It will have a conflict with the AppCompat library.
So how an I have a complete code of support-v4 without experiencing conflicts?
I know that JobIntentService exists in support-compat part of android-support-v4, but adding it beside com.android.support:support-v4 still causes duplications.
Since the first way uses Maven artifacts to get your library from Jcenter, it might download an old version that does not include this class in it's class path.
To resolve this clear libraries of B4A placed in the sdk m2repository
folder named b4a_remote, delete it and let the B4A redownload the files. Therefore it will download fresh and updated libraries that contain this class.
I have the latest Android Support library with Rev 22.2.1. I included the AppCompat v7 library from my SDK it in my workspace by following the guideline at the Android developer guides. Initially it included the project named appcompat_v7 in my project explorer. So far so good.
Then after creating a few projects and including a few other libraries like recyclerview and cardview and some third party library projects, I now notice two projects named appcompat_v7 and android-support-v7-appcompat in my project explorer.
This wouldn't bother me but now whenever I want to add the appcompat v7 library in my project, I am given both the options, and I get confused about which one to use. So the question is that where did android-support-v7-appcompat come from, and which one should I use when I want to include the v7 library in a project (also provided that the project is also using another third party library project).
Select Second Option AppCompat_v7
AppCompat_v7 is actually Android Support library which is introduced recently and is required for Application Compatibility for older versions of Android.
Please select second library (AppCompat_v7) as mentioned in above comment.
You can also read below articles if you need more info:
https://developer.android.com/tools/support-library/index.html
https://developer.android.com/tools/support-library/features.html
Hi I tried using the android supported lib v4 as well as v13 instead of android app lib but eclipse still cannot recognize the getSupportedFragmentManager and getChildFragmentManager functions. Are there any steps I need to take in order fro eclipse to recognize both functions?
Currently using Eclipse luna with latest android sdk, targeting api 17 platform.
I need either function to see why the app crashes with no view found for id ?? when using viewpager inside dialogfragment.
Thanks in Advance.
I found the reason why eclipse cant recognize both functions and that is because while getSupportFragmentManager is available in supported lib v13 but both function are only available in support lib v4 which is weird considering v13 is higher and v4 is included. perhaps they removed getChildFragmentManager function in v13 for some reason. Discovered when using the software provided here jd.benow.ca to search for the function on which class they reside and viola, v13 actually don't have getChildFragmentManager in any of the classes available and it's only existed in v4, so for now, if getChildFragmentManager is needed just use support lib v4 for now or find a way to use both support lib v4 and 13. happy programming using support lib v4 and v13 guys.
I am building an Android Application in which I need to use ActionBarActivity for making use of action bar on devices upto API level 8(Froyo). For this purpose I am including Android Support AppCompat V7 library into my project.
I also want to make use of Google Maps via MapFragment class in google_play_services library project.
Both library project are working fine, when I am importing them individually.
But problem is when I add both of them into same project(I want to use ActionbarActivity and MapFragment in same project). When I am importing them both compiler fails to recogonize classes from any of the library.
Kindly help.
I think here problem is support v4 library just check it in all supported projects libs and if it present all projects libs then remove in all projects remaining AppCompact project. i mean it should be in appcompect project libs and remove in other projects...
Assume name of your project to be SampleApp.
Follow these steps:
1. Delete android-support-v4.jar from the libs folder of your SampleApp.
2. Follow the steps given at Android Developer Reference.
3. Add all the library projects you need.
4. Check if there is repetition of some kind of library in any of the sample projects. e.g. libProjA may contain libProjR and libProjB may also contain libProjR.
5. Remove the repitition if found.
Enjoy Coding!!
I'm encountering a lot of jar mismatch errors lately and I'd like to avoid them in the future.
So, here's my question: suppose I have an app that uses 2 library projects, both of which use the v4 support library jar. In total, I have 3 jar files. What can I do to avoid the jar mismatch error?
All I've read so far is the case where you have a project and a single library project. In this case, I think your supposed to delete the jar file in the project and keep the one in the library project.
This is quite common if your project references several libraries, and each library references the same other library.
An example of this, your app is referencing the android support library v4, and you have 2 libraries which are also referencing the support library v4.
If you update your apps reference to the support library, but you don't update the support library v4 in your other libraries you will see this error.
The best thing is on each referenced library and your app, right click on the project > android tools > add support library. This will get the latest version and you should no longer see these errors.
If you're facing mismatch issue then simply copy one of them and paste in remaining libraries. E.g. as you've 3 v4 support library jars then copy one of them and paste at place of remaining two jars.
Try to understood by my example I used Map and Facebook in My project now Facebook,Map and my project have Android support jar so i removed Android Support jar from Facebook,My project but remain jar on Map,now i'm addded Android-Map-Extension as library project on Facebook And finally add Facebook library project on My project .....