Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Do I need to uses always the last targetSdkVersion?

Simple question: In Eclipse "New Android project" command always tries to uses last available sdk. Is it always a good idea?

UPDATE:

I try to explain. Now in Eclipse, "New project" produces a manifest with:

<uses-sdk
    android:minSdkVersion="8"
    android:targetSdkVersion="17" />

So, target to the last Android (Jelly Bean, 4.2.x) but it can run also on Froyo (2.2). It's ok for me. What could I do very wrong with this choice?

UPDATE

Is it ok if I set android:minSdkVersion="8" + android:targetSdkVersion="17" and the build target to 2.2 to be sure my app will run on older devices (no NoSuchMethodError exception)?

like image 873
Seraphim's Avatar asked Feb 18 '13 14:02

Seraphim's


2 Answers

What could I do very wrong with this choice?

There is nothing wrong with this choice, which is why the build tools default to it.

Setting the targetSdkVersion opts you into specific behaviors that you might not get with an older targetSdkVersion. You can see some of what you get by reading the documentation for Build.VERSION_CODES.

like image 55
CommonsWare Avatar answered Oct 05 '22 19:10

CommonsWare


If you want to develop applications for an older version, it is not a good idea. You can always check what the most used version is and make your application against that version. In some cases it is needed to use the latest version because some functionality is not yet implemented in an older version.

like image 28
TimVK Avatar answered Oct 05 '22 19:10

TimVK