3

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

FuzzyBear
  • 131
  • 1
  • 7

1 Answers1

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] . 
Michael
  • 3,776
  • 1
  • 16
  • 27
  • Hi, I tried the approach, find the jar file is bundled properly in ane file.(b/c file size increase when I add packagedDependencies), however, in my air for android app by including the ANE, recompile everything. When I launch the app, it still cannot find the external library. I don't understand why. Tried a couple of times by removing the ANE, adding back ANE and rebuilding everything. Please help. Thanks – Howy Mar 11 '15 at 01:00
  • Hi, in the directory structure where does one keep the platform-options-android.xml file? Within the platform directory? – devanshu_kaushik Sep 22 '15 at 14:02
  • We keep it at the same level as the extension.xml – Michael Sep 23 '15 at 00:37
  • @Michael can you please have a look at [this](http://stackoverflow.com/questions/32777291/adobe-native-extensions-how-do-i-package-third-party-libraries-jar-in-a-andr) question that I put up? I have listed everything I am trying to do. It would be great if you could let me know what I am doing wrong... – devanshu_kaushik Sep 25 '15 at 10:24