Build Android native library with Adobe Air
Asked Answered
I

4

13

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.

Imaginative answered 3/9, 2012 at 10:45 Comment(4)
I found this link but I did not find any solution on how to use itBrandiebrandise
@AStartupHiringinJodhpur (1) I suggest you remove your above comment about decompiling. I know you're just checking details but... Coders who decompile others projects are seen as attempted code-stealers. No one will help such a person. (2) Feel free to Edit the question with any details about your specific bounty requirements (or are they exactly same as shown?)Disassembly
@VC. Thanks, I just want to use Adobe Air SDK in my project, I need an answer who can guide me in detail.Brandiebrandise
Is the adobe application compiled with gradle?Copalite
C
2

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.

Christiachristian answered 7/10, 2016 at 1:0 Comment(0)
D
0

I'm more of a Flash/AS3 coder than Java so can't give you a full answer but...

A better approach might be to just render your SWF-based User Interface itself via Java code (as opposed to compiling SWF into APK format then trying to embed Flash APK inside Android APK).

This way your SWF can also communicate with Java functions (via AS3's external Interface class). Making it easier to trigger Java functions when a button on the SWF U.I is pressed etc..

You just have to find an SWF render library for Java.

Maybe check out SWFTools. Particularly the SWF Class looks promising.
I have not tested this library but it might help you.

Disassembly answered 9/10, 2016 at 11:22 Comment(0)
S
-1

I am not a Adobe AIR developer at all, however, I have developed a few Android App with both native environment and with some kind of framework (specifically PhoneGap). So, may this can help you.

I don't think that there would be any tool which could directly convert mobile apps build using frameworks like Adobe AIR, PhoneGap or any other HTML5 based framework to a native Android app because technically it is very difficult and unfeasible to do a proper mapping between each and every element of HTML5 (or Flex element in your case) to a corresponding native control or logic. The best you can do is use plugin mechanism provided by your framework to interact with Java and vice-versa and basically that is why the framework is there. For most of HTML5 based frameworks there is a plugin mechanism which allows developer to interact with native functionality (like Background Services, Activity or any other native resource). Even these frameworks are build using the same modular or plugin based approach and there major functionality (accessing Camera, Audio, SD Card etc native resources) works like this. We have to enable that feature before using that in our app.

So, look for plugin type of mechanism in Adobe AIR.

Hope this helps.

Soundless answered 3/9, 2012 at 13:57 Comment(4)
I've probably not correctly describe my problem. I have an application A built with Java, and an application B, built with Adobe Air sdk. I have the source code of both projects. What I need is to start / launch application B when I click somewhere in application A. I'm trying to avoid the download of the two applications, so i'm looking for a solution where app A is embedding app B. But anyway, thank you for your help.Imaginative
I can't really understand the use case of embedding Android apps in one another. If they are highly coupled, then why are you creating two separate apps and if they are loosely coupled then it is better to have two separate apps and let the user enjoy the liberty of installing any of them or both. In this case (loose coupling) if the dependent app does not find the app (you are trying to embed), it should default to some app or functionality.Soundless
It's for a custommer, he would like the adobe air application to be embeded in he's own java application. Basically, what he does not want is to ask the user to download both applications.Imaginative
I have awarded bounty to this question, please suggest any solutionBrandiebrandise
W
-1

Maybe this is a dirty way to help you, but you can :

  1. Install the adobe air program in one computer
  2. Copy the files of the install folder of the adobe air program
  3. Embed all this files in the java application
  4. Install the java application
  5. Save the adobe air files in one folder
  6. Start the adobe air with java (like you will do it with the console, a simple call to YourAirApp.exe)
Whittington answered 25/9, 2012 at 15:17 Comment(1)
I have awarded bounty to this question, please suggest any solutionBrandiebrandise

© 2022 - 2024 — McMap. All rights reserved.