On Sat, Jul 17, 2010 at 11:45 PM, kypriakos <demet...@ece.neu.edu> wrote:
> But older postings and
> some
> sources supported that in general external jars may not work under
> Android

There are a multitude of reasons why an existing JAR may not work on Android:

-- It was compiled with Java 1.4.2 or a non-Sun/Oracle Java compiler
-- It assumes certain classes exist (from, say, JavaSE) that do not
ship with Android
-- It uses JNI (and therefore needs to be adjusted to work with the NDK)
-- It assumes certain platform binary programs exist, or exist at
certain paths, which may not be the case on Android
-- and so on

> and that their corresponding source should be compiled with its SDK
> before
> they can be used

That will directly resolve the compiled-with-wrong-compiler program
and will give you better error information for the
assumes-certain-classes-exist problem.

> In any
> case,
> then it makes no sense as to why the classes are not visible in the
> emulator
> even though I (finally) managed to include the jars in the apk -
> having them in
> the classpath does not do it.

Step #1: Put the JAR in libs/
Step #2: If using Eclipse, add it to your build path
Step #3: Code to the JAR's API and build your APK

and you're done...assuming the JAR is Android-friendly. For example,
here is a sample project using a re-compiled edition of the BeanShell
interpreter:

http://github.com/commonsguy/cw-android/tree/master/Java/AndShell/

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

_The Busy Coder's Guide to Android Development_ Version 3.1 Available!

-- 
You received this message because you are subscribed to the Google
Groups "Android Beginners" group.

NEW! Try asking and tagging your question on Stack Overflow at
http://stackoverflow.com/questions/tagged/android

To unsubscribe from this group, send email to
android-beginners+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-beginners?hl=en

Reply via email to