1

I am facing some questions on android-support-v4.jar now a days.

  1. What is android-support-v4.jar
  2. What will happen if we remove android-support-v4.jar from \libs folder
  3. Which class files are there in android-support-v4.jar
  4. What is exact usage of android-support-v4.jar in Android
user3667402
  • 25
  • 1
  • 5
  • The jar is the library container. Like a dll in Windows. This one in specific gives you backwards compatibility to older devices for using the new API functions (i.e.: Fragments). If you remove it, your project won't be compiled anymore. – Phantômaxx Jun 05 '14 at 15:58

1 Answers1

1
  1. It is the Support Library for Android that provides backward compatibility for developers to use new API Level features in mobiles that doesn't provide that feature. Hence using Support Library you can broaden the range of targeted mobile devices.

The Android Support Library package is a set of code libraries that provide backward-compatible versions of Android framework APIs as well as features that are only available through the library APIs. Each Support Library is backward-compatible to a specific Android API level. This design means that your applications can use the libraries' features and still be compatible with devices running Android 1.6 (API level 4) and up.

  1. You app or atleast some of the features will not work on Android Devices with Older API levels like Honeycomb or Freyo.

  2. You can see all the classes in android-support-v4.jar here.

Eg: Including Support Library you can use ViewPager in API Level 8 which is Freyo.

You can know everything about android-support-v4.jar here.

Augustus Francis
  • 2,694
  • 4
  • 22
  • 32
  • So, with support of **"android-support-v4.jar"** i can implement Fragments with minSdkVersion="8" also. Am i rite? – user3667402 Jun 05 '14 at 16:54
  • Ofcourse you can. Take a look at [this](http://stackoverflow.com/questions/8600483/fragments-in-froyo) and [this](http://stackoverflow.com/questions/6528691/fragments-in-android-2-2-1-2-3-2-0-is-this-possible). If the info helped you, please upvote and accept so others can know this one is right.:) Happy Coding..:) – Augustus Francis Jun 05 '14 at 16:57
  • But i am getting error like minSdkVersion should be 11. And my reputation is less to vote you.sorry :( – user3667402 Jun 05 '14 at 17:01
  • I guess you would ask that. See the second link above.([this](http://stackoverflow.com/questions/6528691/fragments-in-android-2-2-1-2-3-2-0-is-this-possible)). I know its bit of task to set it up. But yes possible. Also if you need an info on API Levels and Android versions see [here](http://developer.android.com/guide/topics/manifest/uses-sdk-element.html). – Augustus Francis Jun 05 '14 at 17:05
  • Showing **"Call requires API level 11 (current min is 8): android.app.Activity#getFragmentManager"** – user3667402 Jun 05 '14 at 17:15
  • Make Sure :
    The activity classes that use fragments must extend FragmentActivity NOT Activity.
    instead of getFragmentManager() you have to use getSupportFragmentManager
    – Augustus Francis Jun 05 '14 at 17:17
  • instead of using import android.app.Fragment for OS>3.0, use import android.support.v4.app.Fragment; – Augustus Francis Jun 05 '14 at 17:18
  • got solution at [here](http://stackoverflow.com/questions/12545462/setadapter-call-requires-api-level-11-current-min-is-8-android-widget-abslis) – user3667402 Jun 05 '14 at 17:20
  • :) Great. Thanks for the link.. I can learn from that too...:) – Augustus Francis Jun 05 '14 at 17:21