Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Build Android native library with Adobe Air

I'm currently working on an Android application built with Adobe Air sdk, in AS3. I was wondering if it's possible to compile a kind of UI library that I can import in a Android native application (Java). Basically, I would like to build my UI with Adobe Air, but the main part of my application with Java, the native way.

What I have in mind is to convert the adobe air-generated APK into a Jar file I would import in the native application project, and call some functions that display something on the Screen.

Is it possible? I think it may be possible, because when I don't import Adobe Air SDK in the application, I must install Adobe Air application with the Play Store to make my application working. I don't find lot of things on Google about that :s.

Thank you for your help.

like image 753
JBS Avatar asked Sep 03 '12 10:09

JBS


1 Answers

Yes it can be done (in theory), but hold on to your hat, it's a bumpy ride!

I see it is a very old question, with a new bounty (the questioner has not logged on for 3 years!), but here we go...
This method goes to the heart of how android java apps are constructed and run (i.e. DEX, so it will work with adobe-air or ANYTHING, it is fundamental [general method]). (by the way you use the word native in a confusing way, native is commonly understood to mean the JNI (c++) library element of an app).
You say:

"What I have in mind is to convert the adobe air-generated APK into a Jar file I would import in the native application project, and call some functions that display something on the Screen."

Android programs are compiled into .dex (Dalvik Executable)[now called ART but binary compatible] files, which are in turn zipped into a single .apk file on the device (with other things like the manifest and resources). (unzip a .apk and look inside).

A .jar file contains DEX files (zipped). (unzip a compiled .jar and look inside).

I have done some work like this before, here's a link to a tutorial and coding examples [tested by me] (in android studio + gradle) [custom build elements are usually needed (I also give an ant example)].

See my stack-overflow answer Dynamic loading of DEX files

This in theory answers your question, but it's fundamental stuff, complex and has limitations that make it hard to code and maintain (resources are a real pain in the a**e).

Question: This all seems very complicated and hard !

Yes it is ! It is an increadably silly an difficult thing to do! That is why we invented cross platform frameworks, (and for web based code javascript/css/html5...). Failing that PORT the code.

like image 144
Jon Goodwin Avatar answered Nov 16 '22 07:11

Jon Goodwin