I have tried on a 1.6 emulator and device. But not a 1.5 emulator.

I see your point. I am not a java expert but I am guessing there maybe some
conditions where the class loader my try to load the missing class even
though the code is not going to be called?

For now I will stick with reflection. But it is going to become
very unwieldy as we support more of the 2.0 apis (e.g
AccountManager/ContactsContract).

On Wed, Nov 18, 2009 at 12:00 PM, Mark Murphy <[email protected]>wrote:

> Nic wrote:
> > We are upgrading our application to add 2.0 support. I have read
> > http://developer.android.com/guide/appendix/api-levels.html and the
> > older blog post
> http://android-developers.blogspot.com/2009/04/backward-compatibility-for-android.html
> .
> > I want to avoid using reflection if possible.
> >
> > I have found that if I set my minSdkVersion="3" in the application
> > manifest but in my build path in eclipse point to the Adroid 2.0 jar
> > file I can compile with direct calls to 2.0 code (with the relevant
> > code to ensure they are not invoked on <2.0 devices).
>
> Have you tested this code on a 1.5 emulator? If it attempts to load a
> class that refers to missing APIs -- even if the code paths would not
> execute those references -- you will fail on a VerifyError.
>
> > What are other people
> > using for multi-targeting different API levels with the same package?
>
> I recommend reflection.
>
> --
> Mark Murphy (a Commons Guy)
> http://commonsware.com | http://twitter.com/commonsguy
>
> Android Development Wiki: http://wiki.andmob.org
>
> --
> You received this message because you are subscribed to the Google
> Groups "Android Developers" group.
> To post to this group, send email to [email protected]
> To unsubscribe from this group, send email to
> [email protected]<android-developers%[email protected]>
> 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 post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

Reply via email to