Wednesday, October 23, 2013

Re: [android-developers] developing with higer sdk than minimun target




On Tue, Oct 22, 2013 at 11:50 PM, firebreather <michaelirvingbrown@gmail.com> wrote:
is there any significant risk in using a higher sdk to develop than the minsdkversion target declared in the manifest? in other words, if i'm developing on android 4.0.3 version 15  sdk/api will the app work correctly on an android 2.3.3 api phone.


Changing the Target API may change some default.

But it is best practice to set the target API to the last (more recent) API you are working with and avoid specifying a max API

the min API can be, and usually is, lower then the target API.

The javadoc, and lint tool will tell you when you use API that are not available in lower API.

Since Android 2.2 Dalvik evaluate the existance of a method when it reach it in it's execution the first time.

Meaning that you can do things like this:

if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB) {
    // use the new API
} else {
    // fallback for the old API
}

If you go back before 2.2 you'll have to use Java Reflection to achieve the same result.

Furthermore the support library greatly helps in dealing with older API and I also use it with min version 15 cause many libraries works only with the "support" Fragments etc.

Another way is to define different classes (fragment, activities, ...) and play with the layout / values sdk modifier to use completely different code for newer and older API

layout/ (default layout, compatible with min SDK)
layout-v11/ (layout used from SDK 11 and above)

as TreKing already told you you should read this link


 
 
currently my app has been working on both tablets and version 2.3.3 phones with this strategy, although the console says I have to declare minimum target 11 or better for tablets. I've been asking this basic question for over a year in forums, stack overflow and support emails without a response.


I don't believe you here.
This is basic. 

--
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscribe@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
---
You received this message because you are subscribed to the Google Groups "Android Developers" group.
To unsubscribe from this group and stop receiving emails from it, send an email to android-developers+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.

0 Comments:

Post a Comment

Subscribe to Post Comments [Atom]

<< Home


Real Estate