Adobe原始扩展:我应如何包装第三方库(的.jar)在Android原生扩展我的Flex应用程序? [英] Adobe Native Extensions: How do I package third party libraries (.jar) in a Android Native Extension for my Flex App?

查看:575
本文介绍了Adobe原始扩展:我应如何包装第三方库(的.jar)在Android原生扩展我的Flex应用程序?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

这是不可以一个重复的问题,我将张贴到他的'接受'的答案并没有为我工作的问题的链接。

This is not a duplicate question, I will post the links to the questions whose 'accepted' answers did not work for me.

我一直在努力的集成的对我的Flex Android应用程序的几个星期了,没有成功第三方库。目前还没有可靠的端至端文档相同。什么 Adob​​e已经记录在案的话题是不够的至少可以说。

I have been trying to integrate a third party library for my flex android application for a few weeks now, with no success. Unfortunately there is no reliable end-to-end documentation for the same. What little Adobe has documented on the topic is insufficient to say the least.

我使用的工具:

  1. ADT从命令行上的Windows 7包装ANE。
  2. Flash Builder在(闪光灯部分ANE)打包最终的APK

对于ANE我的目录结构:

My directory structure for the ANE:

输入图像的描述在这里

我使用的ADT命令:

<Adt path>\adt -package -storetype PKCS12 -keystore ./cert.p12 -storepass <password> -target ane myane.ane ./build/ane/extension.xml -swc ./build/ane/*.swc -platform Android-ARM -platformoptions platform.xml -C ./build/ane/Android-ARM/ . -platform Android-x86 \ -C ./build/ane/Android-ARM/ .

下面是对堆栈溢出了几个问题,我没有指并没有为我工作:

Here are a few questions on Stack Overflow that I did refer to and which did not work for me:

<一个href="http://stackoverflow.com/questions/7732742/air-3-native-extensions-for-android-can-i-how-to-include-3rd-party-libraries">Question#1:接受的答案是简单地结合起来使用Java中的JAR工具均JAR文件。它没有为我工作,试图访问任何类中ThirdPartyJar.jar当我得到一个NoClassDefFound错误。我出口我的祖国,从瓶子的Ec​​lipse这样的:

Question#1: Accepted answer is to simply combine both JAR files using the JAR tool in java. It did not work for me, I get a NoClassDefFound error when trying to access any class inside ThirdPartyJar.jar. I export my Native Jar from Eclipse like this:

输入图像的描述在这里

输入图像的描述在这里

在这里我的疑问是,在结合两个JAR的在哪里我定义的依赖?如何为JAR文件给别人打工谁已经接受了答案的简单组合?

My doubt here is, in combining the two JARs where did I define the dependency? How is a simple combination of JARs working for others who have accepted the answer?

<一个href="http://stackoverflow.com/questions/24626380/how-to-include-additional-jar-in-android-native-extension-for-adobe-air-mobile">Question#2 :在这里接受的答案谈到建立一个平台选项XML定义了说'打包的依赖。似乎更符合逻辑。我试图创建它,因为在我的文件夹结构上面,我使用了ADT命令可见。以下是如何platform.xml的样子:

Question#2 : The accepted answer here talks about creating a platform options XML which defines the said 'packaged dependency'. Seems more logical. I tried to create it, as visible in my folder structure above and the adt command I am using. Here's how the 'platform.xml' looks:

<platform xmlns="http://ns.adobe.com/air/extension/4.0">
    <packagedDependencies>
        <packagedDependency>ThirdPartyJar.jar</packagedDependency>
    </packagedDependencies>
    <packagedResources>
    </packagedResources>
</platform>

起初,我得到了一个'命名空间应该是一样的extension.xml而试图建立的ANE的错误,但之后,我改变了他们两人为..... / 4.0'我可以建立的ANE没有任何错误。然而,当我包括在我的Flex项目的ANE,并试图​​运行方式>移动应用程序,它会给我这个错误:

At first, I was getting an 'Namespace should be same as extension.xml' error while trying to build the ANE, but after I changed both of them to '...../4.0' I could build the ANE without any errors. However, when I included the ANE in my Flex Project, and tried to Run As > Mobile Application, it would give me this error:

输入图像的描述在这里

然后,我会重新命名的strings.xml文件在我的Andr​​oid原生项目,重新构建ANE,得到这个错误:

I would then rename the strings.xml file in my Android Native Project, re-build the ANE, to get this error:

输入图像的描述在这里

我如何得到它的工作?这两种解决方案之间,我曾尝试各种方式向两个JAR一起打包,但它只是不会工作!

How do I get it to work? Between these two solutions I have tried myriad ways to package the two JARs together but it just would not work!

推荐答案

使用平台的选择方法,你的第二个方法是可行的最好方法。

Your second method using the platform options method is the best method available.

与包装相关性与Android和AIR问题几乎总是由AIR SDK构建工具造成的。该版本包括与旧版本的SDK并不足够新,可以从谷歌播放库使用最新的功能也不能使用一些较新的SDK的。

Problem with packaged dependencies with Android and AIR are nearly always caused by the build tools in the AIR SDK. The versions included with older versions of the SDK are not recent enough to use the latest features from the Google Play Library nor use some of the more recent SDK's.

如果您已经安装了Android SDK构建工具,那么您可以复制从集结工具dx.jar文件/ XXX / lib中/ dx.jar了在AIR SDK中的同一个文件设在这里:

If you have the Android SDK build tools installed then you can copy the dx.jar file from build-tools/x.x.x/lib/dx.jar over the same file in your AIR SDK located here:

AIRSDK/lib/android/bin/dx.jar

您必须使用一个从Android构建工具,而不是周围的其他方法代替一个在AIR SDK。

You must replace the one in the AIR SDK with the one from the Android build tools and not the other way around.

我也强烈建议您更新亚洲开发银行在这个时候。更新亚洲开发银行可以解决很多的连接和调试问题。

I also highly suggest you update adb at this time. Updating adb can solve a lot of connection and debugging issues.

您不应该使用一个版本> 20.0的Andr​​oid编译工具。任何高于20.0高于目前已与AIR打包的问题。

You should not use a version > 20.0 of the Android build tools. Anything higher than 20.0 currently has issues with the AIR packager.

如果您使用AIR 18+的构建工具已更新为v20.0.0,你不应该有更新的构建工具,除非您使用更现代化的设施(如支持Android V13 LIB)。

If you use AIR 18+ the build tools have been updated to v20.0.0 and you shouldn't have to update the build tools unless you are using even more modern features (such as the android support v13 lib).

参考: http://airnativeextensions.com/knowledgebase/tutorial/5

这篇关于Adobe原始扩展:我应如何包装第三方库(的.jar)在Android原生扩展我的Flex应用程序?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆