On Sat, Jan 15, 2011 at 7:54 PM, Shawn Brown <big.coffee.lo...@gmail.com> wrote:
> To add a 3rd party .jar to Android I followed Android suggested
> practice(1) by adding the .jar as a Library [not as an Android Library
> under Eclipse (2)], but am
> being told this may induce byte code incompatibilities?
>
> Can I safely use a .jar compiled with a JDK in Android?

Possibly. It depends.

> I think I can but am told by a fellow developer:
>
>  "This is wrong. One missing method (even if it is one of many overloads
> of a single method name) that is present in the JDK but not in Android,
> and you've got byte code that is only compatible with the JDK, but not
> with Android.

That developer is correct. That is one of a few possible problems with
adding third party JARs to Android. That just means you may get errors
when you try using the JAR.

> Using an Android SDK is the only safe (and the easiest) way of getting
> byte code that runs under Android without any surprises. No way, of
> doing the same using only a JDK."

You can certainly set up an Ant project (and presumably an
Eclipse/NetBeans one) that builds against the Android SDK stub runtime
JAR rather than the Java SDK runtime JARs, and that will help identify
possible incompatibilities. However, if you are going to do that, you
might consider just putting the source code in your own project, and
skip the hassle of packaging the JAR. And, there is no particular harm
in just using the Java SDK compiled JAR, assuming your testing of your
application is thorough.

> If this is true, where can I file a bug against your documentation.

What bug?

-- 
Mark Murphy (a Commons Guy)
http://commonsware.com | http://github.com/commonsguy
http://commonsware.com/blog | http://twitter.com/commonsguy

Android App Developer Books: http://commonsware.com/books

-- 
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+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

Reply via email to