Can I use android.os.* libraries in a standalone project?

Posted by medicdave on Stack Overflow See other posts from Stack Overflow or by medicdave
Published on 2010-05-02T23:42:18Z Indexed on 2010/05/02 23:48 UTC
Read the original article Hit count: 304

I'm trying to develop an external library (not sure if that's the right term) to provide prepackaged functionality in Android projects. Working in Eclipse, I've added the appropriate android.jar file to the build path, and everything is happy both while editing and upon compilation.

However, when I use Android's Handler and Message classes (android.os.Handler, android.os.Message) for inter-thread communication, I get exceptions unless I'm running within an Android app, on the emulator or a device. I can no longer test my library in a "standalone" way without having to go through a running Android target.

Is there any way for me to include these two Android classes and still be able to test my library standalone? Do I need to have the Android source available? Or would it require some sort of conditional compilation hand-waving?

© Stack Overflow or respective owner

Related posts about android

Related posts about java