0

Is it possible to run android 3.1 application to run in android 2.1 device? I heard that there is a compatibility in android. And I used API level 3.1 in my application.

Michelle Tilley
  • 157,729
  • 40
  • 374
  • 311
kumar
  • 645
  • 2
  • 14
  • 24

2 Answers2

0

yes you can do this . Use the min sdk version in your manifest file to API level 2.1.

Add the following line in your AndroidManifest.xml file

<uses-sdk android:minSdkVersion="7" />

this will allow your app to run in any device with api level 2.1 or higher.

Dinesh Sharma
  • 11,533
  • 7
  • 42
  • 60
  • 1
    yes use 3.1 as your target version means build & compile your app for 3.1 but use 2.1 as min sdk version that will allow backward compatibility in your app. – Dinesh Sharma Jan 11 '12 at 07:02
  • checkout : http://developer.android.com/guide/topics/manifest/uses-sdk-element.html & http://stackoverflow.com/questions/4568267/android-min-sdk-version-vs-target-sdk-version – Dinesh Sharma Jan 11 '12 at 07:05
  • Out of interest, does the compiler complain if you try to use classes that was introduced from 3.x onwards? – Jimmy Jan 11 '12 at 08:07
  • compiler never compains as your target build version is same but you get a runntime error when you are trying to access any classes that are introduced in 3.X onwards. – Dinesh Sharma Jan 11 '12 at 08:16
0

There are two things: the compatibility mode: http://developer.android.com/guide/practices/screen-compat-mode.html and the compatibility libraries: http://developer.android.com/sdk/compatibility-library.html

The compatibility mode takes care of adjusting the screen to fit the device on post-3.0 devices even if the app has not been tailored for the specific screen. The compatibility library ports some of the Honeycomb features back all the way till Android 1.6.

Besides these, standard backward compatibility concepts apply.

Vikram Bodicherla
  • 7,133
  • 4
  • 28
  • 34