Implementing ActionbarSherlock - android

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.

Related

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

Creating Java libraries compatible with Android SDK

I want to create a Java library like SLF4J which can run since certain Android version (e.g. Froyo/2.2).
The thing is, I can't be sure if some methods I use are already available on that Android version. For example, "String".isEmpty() is not available in Froyo. How should I know this, unless I create the library project as Android Library project?
Making the project as an Android library project is not easy to test. Robolectric is also tricky with Gradle.
I'm expecting something like simple Java Maven project which uses subset of Java API available in certain Android version. Is it possible? Like, I create a new SLF4J library without involving non-existent methods in Android.
Thanks
It's possible that there are differences between the Android SDK and other Java APIs, so if you build and test your code as anything other than an Android library, you may miss problems. For example, just the other day I found a bug in API 19 (Android 4.4) where DecimalFormat produces BigDecimals differently than it does in J2SE SDKs.
But if you must do this, the easiest way is probably to create it as an Android library project and build it against the Froyo SDK to ensure all the methods are available. Then take the same code and create different build files to build it for your preferred test framework.

Compatible with older versions of 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.

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.

zxing library minimium SDK & core.jar

I'm trying to compile the ZxING BarCode scanner, that comes from default for SDK 7. The problem here, is that I want to compile and test it on a SDK 4 device, so when I change in properties the android version and the target SDK on the ManifestFile a lot of errors appears. Is there a minimum SDK requirement for ZXING? Is there a version of the zxing library for older SDK's?
"Is there a minimum SDK requirement for ZXING?"
Yes apparently so, SDK 7 =). Yet another reason to integrate with intents rather than including your own copy of the library.
The All Downloads page on zxing site contains links to old versions of the project zip. Perhaps one of the deprecated versions will work for you? (although at the cost of losing anything that got fixed with newer versions)

Categories

Resources