How to include additional Jar in Android Native Extension for Adobe Air Mobile

六月ゝ 毕业季﹏ 提交于 2019-12-18 05:13:18

问题


I have build a pretty nice little app using Adobe Air Mobile (FlashBuilder) and Android Native Extensions (ANE). I would like to incorporate the Jayspt encryption library with my ANE but I can't seem to find any documentation telling how to do it. If I do the standard ADT export to jar for the ANE build, it doesn't include the jayspt jar.

Does anyone know how (spell it out for me) to include another jar in the ANE?

Thanks, FB


回答1:


Firstly make sure you're using AIR 4.0+ to package. Earlier versions definitely can do it as well but the following method is much easier and doesn't require repackaging of the jar. Firstly you just add it to your Android project as an external lib, this will make all the functions available in your code.

Then create a platform-options-android.xml for android, it should look like the following:

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

You'll need to make sure that the jayspt.jar file sits in the same directory as your native extension jar file.

Now in your packaging script make sure you specify the platform options for android:

adt -package [YOUR NORMAL OPTIONS] \
     -platform Android-ARM -platformoptions platform-options-android.xml -C [PATH TO YOUR LIB] . 


来源:https://stackoverflow.com/questions/24626380/how-to-include-additional-jar-in-android-native-extension-for-adobe-air-mobile

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!