I'm a newbee in android platform. Im trying to create one appliccation in the latest version. but i want to run that app in the lowest versions.I just heared about using supported libraries along with the application.
I have some doubts about that
How we can add supported libraries in our application, from where we can download that?
when we develop using spported libraries .when we run on a lowest platform , which functionalities of the highest version we can use?
is highest versions UI is supported in lowest version?
give some example for adding the supported libraries..
Thanx in advance !
The Support Library is a quiet extending topic. I would suggest to read through it here. But here are some answeres to your questions.
Just Right Click on your project > Android Tools > Add Support
Library (With the little Android icon.)
What exactly is supported can be read here Using the v4 Library
APIs. It adds support for some of the most useful features of
later Android versions. Take a look at Fragments, Loaders and
ViewPagers.
If I understand your question correctly, there are some view you can
use with the support library, but if you want the Actionbar in 2.3
you need to use a library like ActionBarSherlock.
An example for adding the support library is a little hard, just do
what I wrote in 1. But here is a example of using the support
library with Fragments.
First import the support library classes:
import android.support.v4.app.Fragment;
import android.support.v4.app.FragmentManager;
import android.support.v4.app.FragmentTransaction;
And then us them:
#Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.content);
// getSupportFragmentManager() is for getting the
// FragmentManager of the Support Library
// this is the only support library part
FragmentManager fm = getSupportFragmentManager();
// from here like a normal fragment, create the fragment
Fragment frag = ExampleFragment.instantiate(this, "ExampleFragmentName");
// start a fragment transaction
FragmentTransaction ft = fm.beginTransaction();
// add the fragment to the transaction
ft.add(R.id.content, frag);
// commit the fragment transaction
ft.commit();
}
I hope this is helpful.
See link from #Marko Niciforovic
Support library is as said mostly for the support of fragment and fragment transaction before Android 3.0
Simple and short answer is no. You would have to write your own Themes and Styles.
Eclipse --> Right click on project --> Android Tools --> Add support library
If it's not working, check that on the projects build path --> right click project --> build path --> configure build path in the tab order & export the "Android Private Libraries" or "*android-support-vx.jar" is exported (checkbox ticked).
Hope we could answer your questions.
I think supported lib is mostly used for fragments because they are added in 3.0. To use android support library you can download it directly from eclipse, check here http://developer.android.com/training/basics/fragments/support-lib.html, but mostly its something like this:
Eclipse -> Window -> Android SDK and AVD Manager -> Available Packages -> Android Support
http://developer.android.com/tools/extras/support-library.html
Downloading the Support Package
The Support Package is provided as a downloadable package from the Android SDK Manager. To install:
Launch the Android SDK Manager.
From Eclipse, you can select Window > Android SDK Manager. Or, launch SDK Manager.exe from the / directory (on Windows only) or android from the /tools/ directory.
Expand the Android Repository, check Android Support package and click Install selected.
Proceed to install the package.
When done, all files (including source code, samples, and the .jar files) are saved into the /extras/android/support/ directory. This directory contains each of the different support libraries, such as the library for API level 4 and up and the library for API level 13 and up, each named with the respective version (such as v4/).
Open Android SDK MAnager. Scroll down to Extras. Under Extras choose Android Support library and click install.
Setting Up a Project to Use a Library
In your Android project, create a directory named libs at the root of your project (next to src/, res/, etc.)
Locate the JAR file for the library you want to use and copy it into the libs/ directory.
For example, the library that supports API level 4 and up is located at /extras/android/support/v4/android-support-v4.jar.
Add the JAR to your project build path.
In Eclipse, right-click the JAR file in the Package Explorer, select Build Path > Add to Build Path.
Check the link below under the topic Using the v4 Library APIs
http://developer.android.com/tools/extras/support-library.html#Downloading
Don't start with the latest SDK all the time. Start with the minimum version may be ginger bread 2.3. Use ICS only if u want to add ICS specific items such as expandable widgets and all.
Related
I am making an android app that contains action bar and fragment which are not supported for API level 8!
So I just tried to import support library V7 to fix this problem!
But when I try to do it , it doesn't find support library for V7 , there is support.v4 but not v7.
what should I do to fix it?
Should I download anything for my android SDK?
Download Android Support Library in Your SDK manager under Extras. Then Import appcompat from following folder in your sdk.
Android-SDK\extras\android\support\v7\appcompat
The first step is to download the library through the SDK manager.
Support library v7 is a library project, so needs to be added as a new project to your workspace.
Note: You can't just drop the .jar in because it has additional XML resources.
There's some pretty thorough instructions on how to add it located here.
This error appears when creating a new Android Application module in Android Studio using Fixed Tabs + Swipes for navigation.
It says:
The following dependencies were not resolvable. See your build.gradle
file for details. - com.android.support:appcompat-v7:18.0.0
I'm targeting Android 4.0+ devices. Why is the compatibility library involved? One workaround is to install this library using the Android SDK manager, but I'm concerned my app will actually use this compatibility library when there is no reason to. The ActionBar and fixed tab navigation should be built-in to the Android 4.0+ framework right?
This happened to me with IntelliJ Idea 13 Ultimate when creating new Gradle Module. I was working on the app that supports Froyo. I had to manually add support libraries to the SDK. After that I was able to build just fine. Here is the screenshot of Project Structure settings for SDK that I have:
As you can see, support for v4, v7 and v13 which were added manually. Those will be associated with Android API 19 Platform (in my case). When you create next new Gradle Module, you will still need to go to Project Structure to select the SDK under Project, but you will not need to add support libs again. Hope this helps.
I installed the compatibility library anyways. Something I didn't realize is that you can't create your first module by using File -> New Module. You have to use File -> Project Structure -> New Module for your first module. It's really unintuitive. After I did this, then everything worked.
I can't understand why am I getting this error:
When another people don't get it and are able to create a new project with inner navigation like that. powered by compatability library:
PS: I have every single package of android SDK Tools installed on my computer, and they're all up to date
It is because the wizard doesn't take the compatibility library into consideration. Set your minimum to 14 and then go and change the manifest after you have created your project and include the compatibility library.
I want use ActionBar for my application but i found it can't use for android < 3.0.
I found this https://github.com/johannilsson/android-actionbar to solved my problem but I get error at
import com.markupartist.android.widget.ActionBar;
import com.markupartist.android.widget.ActionBar.Action;
import com.markupartist.android.widget.ActionBar.IntentAction;
Give ActionBarSherlock a try. I use it for one of my projects and after some reading of the docs and the samples it just worked. The samples are easy and straight forward, you should be able to extract what you need from them.
To see what it's able of just download the sample app from the market: Sample App (requires at least Android 1.6)
You should add the code to a library, and add the library to your project.
To do this in Eclipse create a new project, using the same package name as the github project (so com.markupartist.android.widget). In the properties select the project to be a library under the Java Build Path tab. Then, in your project, go to its properties, and select the library.
I think your including files are missing (JAR libs) , Click on error icon and then select fix project setup.
I spent around 10 hours trying to fix this problem. All the above ans does not work. Actually what is missing is android support library. To fix this, right click on project, >Android Tool> Add Support Library. Hope this save alot of time for other who came across this. just add support library both on your ActionBar library and the current project.
In "Fragments for All", Xavier Ducrohet, Android SDK Tech Lead says Google releases an Android Compatibility Package by SDK Manager.
I've installed it, but, how can I use it now?
How can I integrate Android Compatibility Package in my project?
If you're using version 12 or later of the Eclipse Android support library, just right-click on your project, and choose Android Tools > Add Compatibility Library...
There is a .jar file called android-support-v4.jar in the directory {yoursdkpath}/extras/android/compatibility/v4/. Copy this into your libs folder in the root of your project and add the file to the build path in Eclipse.
Premier,
I followed the Fragments example on the Android Developers Blog to create a "backwards" compatible app using Fragments. In the article there is a brief mention of the Main activity that uses a layout with fragments.
The code for this activity is not interesting; it just calls setContentView() with the given layout:
What should be mentioned here is that this activity must derive from FragmentActivity and not Activity class. This threw me off for a while.
Good luck
Refer Using Fragment of Android Compatibility Package may help you
Check the "Step 2: Configuring the Build Path" Section here
This is easy with new Eclipse I downloaded. Provided you have all the paths for SDK etc setup correctly, Right click on Project -> Android tools-> and Hit "Add compatibility Library" it will add the JAR file