How to use API level 17 methods in an application and execute code for Ginger Bread?

I am new to android. I downloaded the ADT and it comes with the Jelly Bean (API Level 17) SDK.

I set the target sdk file as "9" in AndroidManifest.xml.

I can use the latest API level 17 methods and it works great on the Android JB simulator.

But after creating the assembly, if I try to install it in my real device for ginger, the simplest application will not start and crash.

Can someone suggest me a solution?

+4
source share
2 answers

Download the Gingerbread SDK (API level 9, Android 2.3) and compile your code. You will get compile-time errors when using methods that do not exist in Gingerbread. Then you will need to decide what to do with it. You can either

  • remove these method calls and use other / similar ones that are available in version 2.3 OR
  • use a backward compatibility library (if one exists)
+1
source

Check your AndroidManifest.xml and find the tag. Even if your application is intended for API 17, devices with earlier versions of the API, you can continue to support them by specifying a minimum API attribute.

Example:

<!-- minimum API version is 8 = GingerBread_MR --> <uses-sdk android:minSdkVersion="8" android:targetSdkVersion="17" /> 
+1
source

All Articles