Compatible with older versions of Android - android

http://developer.android.com/training/implementing-navigation/nav-drawer.html
I have implemented this feature, it quite well works on android 4.0 and up.
But I need to make this project compatible with android 2.2, 3.0 etc.
I tried to add android-support library but it does not work, since someone suggested to do so.
How can I achieve my goal?

It should work with adding the support v4 library jar. However, it is recently added and using an older version of this jar will result in errors.
Update your ADK & ADT and start a new Android project. This will create a new project with the latest and greatest support v4 library. Just copy-paste that in your libs/ folder of your own project to replace the old one.

Related

Android support library wrong version

I have a problem while building my android project due to some missing android-support-library (i.e: android-support-v7.jar) so to fix it I had to add an Android Support Library from eclipse wizard. However I was surprised that my $android_sdk_home/extras/andoird/support/v7/appcompact/libs contains android-support-v4.jar and android-support-v7-appcompat.jar. Is that normal?
If I understood you correctly, you're wondering if having both v4 and v7 support libraries is normal. It is perfectly normal as they have different purposes. Basically they provide you with widgets and APIs to be used respectively in API levels 4 and 7 and beyond. They also provide different interfaces.
You can read about it here in more detail: https://developer.android.com/topic/libraries/support-library/features.html

Create android eclipse project using SRC and res folder

Sir
I have a project having only src and res folder
And I know that it is targets api 22
And it need library Google play service and v7 compat .
How do I create a project in eclipse or Android studio having above things please help?
Refer to this for everything you need to know: http://developer.android.com/develop/index.html
EDIT:
In Android Studio, look in the toolbar for File->New->New Project. Android Studio will guide you through the process and you can specify your target API and things from there on.
Google does not develop the ADT plugin(the required plugin so you can develop android in eclipse) and they recomend you transfer to Android studio. I have had that same problem with appcompat crap and it is solvable in two ways(as far as I have seen):
1: Use Android Studio instead, as it really truly supports all android related dev requirements, including app compat.
2: In your project, set minimum API level to Android 4.0.3 or above. This way you prevent the requirement for appcompat.
I recently transfered from Eclipse to Android Studio, and the transition was easy, and once I found out how I could use the Eclipse keybindings, it was just the GUI that was different. It is really easy geting used to Android Studio, and I recomend you start using it as soon as you can. It will solve most of your problems related to appcompat and other libraries that needs to be added to support earlier versions of Android
As you see on the image, there is a "Minumum required SDK". The minimum SDK and target SDK are two different options, and target should be the newest SDK, while minimum should be(in my opinion) Android 4.0.3 or higher. According to Google, this allows you to reach about 90% of all Android users
EDIT
Using Android Studio, as long as the SDK has everything installed and Android Studio is as new as possible, it will add appcompat v7 automatically without issues. Eclipse's ADT plugin is outdated and probably doesn't support appcompat anymore. I personally preffer eclipse, but due to android issues, I had to move over to Android Studio

How to add two librarys with same name to Eclipse?

I'm trying to add Google Play Services and Google Play Services for froyo library to my proyect but Eclipse don't let me, the reason is I need the new library for Chromecast compatibility and need the old one to make work Admob on Android 2.2 devices.
Use same android-support-v4.jar library in both library and your main project.
To do this remove android-support-v4.jar file form both library and your main projects build path and then remove android-support-v4.jar from your libs path. Then reinsert same android-support-v4.jar in both library and main project. Then use add to build path to add lib to your projects.
This will solve your problem.
Please read more Error on add library project in eclipse
Consider the business proposition. Froyo devices account for exactly 1.0% of the market (as of 1-MAY-2014). How many $$ worth of effort do you to spend to cater to that 1%?
Suggest you drop support for advertising for Froyo devices. Let them run the game for free.

If app only targets Android 4.0 and up, can v4 support library be removed from project?

I've written an app that only targets Android 4.0 (Ice Cream Sandwich) and up. android-support-v4.jar seems to be a dependency in my Eclipse project by default. Since I'm not targetting any lower than 4.0, can I remove this support library as a dependency, because it is not needed...? I don't want any unnecessary bloat being packaged with my application (correct me if that's not actually how it works).
If so, how does one remove it in Eclipse? I can't seem to find an option anywhere.
Sure. Just delete the jar, and if you don't have any other dependencies the whole libs/ folder.
uncheck create icon and uncheck create activity, when you create a new android application project. In this way, adt will not import support library, and the application template just finished.

Implementing ActionbarSherlock

I am trying to implement SherlockActionbar. I downloaded the project from GitHub and imported the library as a Project and using Android 2.2 as the base SDK.
But the Project seems to have a lot of errors.
Guess i need to import some other library.
You need to compile with Android 3.2. The library needs access to classes from the Honeycomb SDK in order to support it when run on 3.0+
Despite compiling with the newer SDK, you can still support back to Android 2.2 by setting the minSdkVersion to '8'.
Each of the samples in the repository (for version 3) support back to Android 1.6. Take a look at their sources for more information and examples.

Categories

Resources