mk中添加外部jar引用

mk中添加外部jar引用

本文介绍了在Android.mk中添加外部jar引用的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想在内置的android应用中添加一个外部第三方jar文件.

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

我在Android.mk中添加了LOCAL_CLASSPATH变量,因此编译可以正常进行.但是在运行时,它无法找到JAR中的类定义.

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.

我需要设置哪个变量以在.dex/.apk中添加第三方JAR?

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

TIA.

推荐答案

这是我用来解决问题的方法:

Here is what I used to solve the problem :

LOCAL_PREBUILT_STATIC_JAVA_LIBRARIES := path_to_jar_file.jar
include $(BUILD_MULTI_PREBUILT)

应在 include $(BUILD_PACKAGE)

您还需要在 LOCAL_STATIC_JAVA_LIBRARIES 中指定库名称进行编译.

You also need to specify the library name in LOCAL_STATIC_JAVA_LIBRARIES for compilation.

这篇关于在Android.mk中添加外部jar引用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-26 12:40