I am creating a widget that we will provide to developer end users and it consists of a .jar and a native library (.so) built using the NDK. The JAR has a JNI interface to the dynamic library.

It's very clear on how to include an external .jar in a project but not how to include a dependent dynamic library.

  1. How do I package up and build the .jar and .so? What are the best practices here?

  2. I can create the JAR file using the JDK's jar command. Do I need to run dx.bat on the jar to convert to Dalvik bytecode?

  3. I need to create a sample project showing the widget in action. How do I include this .jar and .so in a sample project that demonstrates how to use the widget?

Edit
Report