Using targetSdkVersion

by Peter Eastman » Sun, 27 Jun 2010 03:13:58 GMT

Sponsored Links
 I'm stuck on a problem that I'm sure has a very simple answer, but I
haven't been able to figure it out.

I have a program that should work on Android 1.5, but when it's run on
newer devices with higher resolution screens, it should support the
full resolution and not emulate a lower resolution screen.  As far as
I can tell from the documentation, this should be simple.  I just

<uses-sdk android:minSdkVersion="3" android:targetSdkVersion="4"/>

The problem is that if I tell Eclipse to compile for 1.5, it refuses
to accept this.  It reports an error (targetSdkVersion is an unknown
tag) and refuses to compile or run.  If I tell it to compile for 1.6
it works fine, of course.  But if I then try to install on a 1.5 AVD,
the program immediately crashes with a java.lang.VerifyError.  I'm
clearly missing something simple.  How do I get it to compile an apk
that works under 1.5, but still includes the targetSdkVersion tag?



Using targetSdkVersion

by YuviDroid » Sun, 27 Jun 2010 04:02:27 GMT

 The VerifyError occurs when you are using (or only 'importing') stuff that
is only in the newer API.
In this case I think you should use reflection to use the new APIs
methods/classes in Android > 1.6.


Sponsored Links

Using targetSdkVersion

by Peter Eastman » Sun, 27 Jun 2010 04:13:04 GMT

 You're right, my fault.  Because I had Eclipse set to 1.6, I missed
the fact that I was calling an API that didn't exist in 1.5.




Other Threads

1. Italics clipped in widget

I've got a button with italics text in an app widget and the last
letter gets clipped when I set the width to wrap_content.  It doesn't
get clipped with fill_parent, but then that messes up the selection

Things I've tried:
 - space after my text - seems to get trimmed off automatically
 - layout_marginRight
 - paddingRight

Anybody know what's going on here?  Is this a bug?


2. Detecting if there is a screen unlock pattern?

Is there a way, some API one can call to detect if the user has set a
screen unlock pattern or not?


3. XMPP event synchronization for multiplayer game development

4. Android Emulator 2.1: Setting HTTP Proxy

5. to fix a credit card reader compatibility with android phones

6. 9-patch background image affects margins?

7. How to implement onMeasure() for my custom widget