简体   繁体   English

如何将第三方jar文件添加到我的android应用jar文件中?

[英]How to add third-party jar files into my android application jar file?

I have an Adobe AIR application for Android. 我有一个适用于Android的Adobe AIR应用程序。 Using for this AIR 3.0 and Flash Builder 4.6. 用于此AIR 3.0和Flash Builder 4.6。 I need to make MyANEFile.ane - which must include 2 external .jar files: Flurry.jar + Tapjoy.jar. 我需要制作MyANEFile.ane-必须包含2个外部.jar文件:Flurry.jar + Tapjoy.jar。 But when I made .ane file - it does not work. 但是当我制作.ane文件时-它不起作用。 How can I add this 2 jar files to my main application jar file to make .ane file properly? 如何将这2个jar文件添加到我的主应用程序jar文件中,以正确制作.ane文件? Thanks. 谢谢。

It shows me such errors in dalvik: 它向我显示了dalvik中的此类错误:

*01-31 21:37:37.046: I/dalvikvm(12983): Could not find method com.amobee.agency.tracking.AmobeeReceiver.amobeeTracking, referenced from method com.mycompany.extensions.AmobeeInitAmobeeTrackingFunction.call * 01-31 21:37:37.046:I / dalvikvm(12983):找不到方法com.amobee.agency.tracking.AmobeeReceiver.amobeeTracking,引用自方法com.mycompany.extensions.AmobeeInitAmobeeTrackingFunction.call

01-31 21:37:37.046: W/dalvikvm(12983): VFY: unable to resolve static method 317: Lcom/amobee/agency/tracking/AmobeeReceiver;.amobeeTracking (Ljava/lang/String;Landroid/content/Context;Ljava/lang/String;)V* 01-31 21:37:37.046:W / dalvikvm(12983):VFY:无法解析静态方法317:Lcom / amobee / agency / tracking / AmobeeReceiver; .amobeeTracking(Ljava / lang / String; Landroid / content / Context; Ljava / lang / String;)V *

Suppose your main extension jar file is extension.jar and you are using code in external.jar. 假设您的主要扩展jar文件是extension.jar,并且您正在使用external.jar中的代码。 Then you can put the classes from external.jar into extension.jar using the Java jar tool : 然后,您可以使用Java jar工具将external.jar中的类放入extension.jar中:

jar -xf external.jar jar -xf external.jar

This will extract the .class files into package folders. 这会将.class文件提取到软件包文件夹中。 If the top-level package is "com", then you can add those to extension.jar with: 如果顶级软件包是“ com”,则可以使用以下命令将其添加到extension.jar中:

jar -uf extension.jar com jar -uf extension.jar com

(Repeat the second command for each top-level package in the external jar.) (对外部jar中的每个顶级程序包重复第二个命令。)

If you are using Eclipse to develop, right click on the project and go to: 如果要使用Eclipse进行开发,请右键单击该项目,然后转到:

Properties -> Java Build Path -> Libraries -> Add External JARs 属性-> Java构建路径->库->添加外部JAR

I was having issue with creating an Android ANE for AdMobs and this is what worked for me. 我在为AdMobs创建Android ANE时遇到了问题,这对我来说很有用。

Do like Flynn suggested and add the jar in the Java Build Path: 像Flynn建议的那样,将jar添加到Java Build Path中:

Eclipse Java Build Path在构建路径中显示GoogleAdMobsAdsSdk jar

Then, the only way I could get the AdMobs jar to play nice in the ANE was to export the Android native jar for the ANE with Export... -> Java -> JAR File and have both "Export all output folders for checked projects" and "Export Java source files and resources" checked: 然后,我可以使AdMobs jar在ANE上正常运行的唯一方法是使用Export ...-> Java-> JAR File导出ANE的Android本机jar,并同时“导出所有已检查项目的输出文件夹” ”和“导出Java源文件和资源”已选中:

Eclipse JAR导出,选择了“导出所有输出的文件夹以检查项目”和“导出Java源文件和资源”

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 如何在liferay中部署第三方jar文件? - How to deploy third-party jar files in liferay? 如何将第三方 jar 文件加载/添加到 bitbucket? - How to load/add third party jar files to bitbucket? 如何在Notes Xpages应用程序中添加外部第三方jar? - How to add external third party jar in Notes Xpages application? 如何在 Windows 10 中使用命令提示符在编译和运行时包含第三方 jar 文件? - How to include a third-party jar-file in compilation and runtime using command prompt in Windows 10? 如何添加第三方jar到mapreduce工作? - How to add third party jar to mapreduce job? 如何在不使用第三方工具的情况下在应用程序jar中引用jar? - How to refer jar inside my application jar without using third party tools? Maven在带有第三方库的JFrog工件(snapshot-repo)中找不到jar文件 - maven can't find jar file in JFrog artifactory (snapshot-repo) with third-party libs 从Eclipse中的第三方jar查看源代码 - Viewing source code from a third-party jar in Eclipse 使用Bukkit的Minecraft Server中的第三方jar(Twitter4J) - Third-party jar (Twitter4J) in Minecraft Server with Bukkit 如何将权限和代码库属性放入第三方jar的清单? - How to put Permissions and Codebase attributes into third-party jar's manifest?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM