Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Adding a external jar reference in Android.mk

Tags:

android

I want to add a external third party jar file in the inbuilt android app.

I've added the LOCAL_CLASSPATH variable in Android.mk due to which the compilation goes fine. But during runtime, it is not able to find the class definiation which is in the JAR.

Which is the variable I need to set to add the third party JARs in the .dex/.apk ?

TIA.

like image 923
Karan Avatar asked Apr 08 '10 07:04

Karan


1 Answers

An example is more than just talking.

...

LOCAL_STATIC_JAVA_LIBRARIES := libmylibs

LOCAL_PACKAGE_NAME := myapp

...

include $(BUILD_PACKAGE)

##################################################
include $(CLEAR_VARS)

LOCAL_PREBUILT_STATIC_JAVA_LIBRARIES := libmylibs:mylib.jar

include $(BUILD_MULTI_PREBUILT)

Note: put the "mylib.jar" at the project root.

like image 61
davidj Avatar answered Oct 02 '22 12:10

davidj