How to add third party jar in compile time but not runtime

本文详细介绍了在Android开发中如何在编译时引入第三方jar包,同时确保该jar包不在最终的apk中体现,而是通过Android SDK插件在运行时动态加载。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

原文在https://groups.google.com/forum/#!topic/android-developers/1L_O7XGXsoE
12-1-16
Jelly Chen  There are two ways to build apk: ( I don't have the source of thirdparty.jar) 1. Use eclipse I have put the thirdparty.jar to lib dir( or any other dir on the filesystem). and then "Add Library" in the Eclipse. and compile ok. After building, i see
Jelly Chen 
12-1-17
The Android.mk I use is:

LOCAL_PATH:= $(call my-dir) 
include $(CLEAR_VARS)
LOCAL_MODULE_TAGS := optional
LOCAL_SRC_FILES := $(call find-other-java-files, src)
LOCAL_PACKAGE_NAME := Hello3RdJar
LOCAL_STATIC_JAVA_LIBRARIES := thirdparty_jelly 
include $(BUILD_PACKAGE)

include $(CLEAR_VARS)

LOCAL_PREBUILT_STATIC_JAVA_ LIBRARIES := thirdparty_jelly:lib/ thirdparty.jar

include $(BUILD_MULTI_PREBUILT)
Mark Murphy 
12-1-17
For questions about custom firmware, please visit  http://source.android.com.

2012/1/16 Jelly Chen <sino...@gmail.com>:

- 显示引用文字 -
> --
> You received this message because you are subscribed to the Google
> Groups "Android Developers" group.
> To post to this group, send email to  android-d...@googlegroups.com
> To unsubscribe from this group, send email to
android-developers+unsubscribe@googlegroups.com
> For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

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

Android Training in DC: http://marakana.com/training/android/

Jelly Chen 
12-1-17
I found the solution.

1. Android.mk
replace LOCAL_STATIC_JAVA_ LIBRARIES := thirdparty_jelly 
with      LOCAL_JAVA_LIBRARIES := thirdparty_jelly 

2. Eclipse
Use SDK addon.
copy an existing addon, replace the .jar, modify manifest.ini and  source.properties a little.

lgaur 
13-7-31
Hi Jelly Chan,

I am trying to compile apk with some jar file and I don't want jar file to be part of .apk. I want at runtime apk should take jar file contents or .classes from system or device.

I am developing this using ADT . Could you please provide more info how to achieve it while using eclipse or ADT ?

Regards
Lokesh
- 显示引用文字 -
Kristopher Micinski 
13-8-1
Re: [android-developers] Re: How to add third party jar in compile time but not runtime
That's not possible unless you distribute the library as part of the firmware. 

Why wouldn't you want the code to be part of the APK?  Perhaps there's 
something else you could do. 

Kris 
- 显示引用文字 -
> -- 
> -- 
> You received this message because you are subscribed to the Google 
> Groups "Android Developers" group. 
> To post to this group, send email to  android-d...@googlegroups.com 
> To unsubscribe from this group, send email to 
android-developers+unsubscribe@googlegroups.com 
> For more options, visit this group at 
http://groups.google.com/group/android-developers?hl=en 
> --- 
> You received this message because you are subscribed to the Google Groups 
> "Android Developers" group. 
> To unsubscribe from this group and stop receiving emails from it, send an 
> email to  android-developers+unsubscribe@googlegroups.com
> For more options, visit  https://groups.google.com/groups/opt_out


Jelly Chen 
13-8-1
Re: [android-developers] Re: How to add third party jar in compile time but not runtime

Use android sdk add on, it's in sdk dir , like google map add on.

在 2013-7-31 下午9:23,"lgaur" < lokes...@gmail.com>写道:
- 显示引用文字 -
-- 
-- 
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to  android-d...@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscribe@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
--- 
You received this message because you are subscribed to a topic in the Google Groups "Android Developers" group.
To unsubscribe from this topic, visit  https://groups.google.com/d/topic/android-developers/1L_O7XGXsoE/unsubscribe.
To unsubscribe from this group and all its topics, send an email to  android-developers+unsubscribe@googlegroups.com.

For more options, visit  https://groups.google.com/groups/opt_out.
 
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值