Skip to main content
timgraupmann
Participating Frequently
July 7, 2016
Question

Adobe Native Extension Support for the AAR Format

  • July 7, 2016
  • 3 replies
  • 2205 views

I was able to wrap the Cortex Store API JAR with an Adobe ANE Extension as documented in the online docs.

docs/adobe-air.md at master · ouya/docs · GitHub

In the next version of the Razer SDK, it actually outputs from Android Studio in the AAR format.

AAR Format - Android Studio Project Site

AAR files can hold resources, assets, JAVA classes, and native libraries.

In the past I scripted combining the Cortex SDK JAR and the Adobe Air Plugin JAR together into the ANE target JAR file with a script that outputs the ANE file.

ouya-sdk-examples/build_ane.cmd at master · ouya/ouya-sdk-examples · GitHub

The script uses the ADT tool in the Air SDK Compiler to create the ANE file which can be used in Flash projects.

It would be great if a future version of the ADT tool could take the raw AAR file and bundle the ANE file.

Even better it would be great if the ADT tool would bundle a set of AAR files. That way I don't need to manually merge the compiled Java classes into a single JAR/AAR.

I do have a workaround that will probably work in which I'll need to do the following in order to use the AAR format.

1. Extract the classes.jar from the AAR file.

2. Extract the classes from each classes.jar file.

3. Combine all the classes into a single JAR file.

4. Name the JAR file as the expected ANE JAR name.

In my case that JAR name needs to be AirOuyaPlugin.jar for the ADT packaging tool.

Anyway, my purpose with this post is to let support know that AAR format support for ANE packaging is greatly appreciated.

Thanks,

~Tim Graupmann

This topic has been closed for replies.

3 replies

timgraupmann
Participating Frequently
July 8, 2016

I have the ANE extension building from an AAR and running. When I'm finished with the docs, I'll post my final version here.

You can see the solution, documentation, and source here.

GitHub - razerofficial/adobe-air-razer-sdk: The Adobe Air / Animate CC/ Flash Plugin for the Razer SDK

timgraupmann
Participating Frequently
July 8, 2016

It turns out that it's also important to compile the AAR/JAR with the JDK 1.7 with a target of 1.7.

Bad magic errors occur if you try to compile the ANE with a target of 1.8.

I'm on to the next step of testing the APK...

It RUNS! WIthout crashing.

Okay now to fix some initialization issues...

07-08 09:25:07.025 15689 15689 D RazerSDKNativeExtension: ******** RazerSDKNativeExtension initialized ********

07-08 09:25:07.025 15689 15689 I art     : Rejecting re-init on previously-failed class java.lang.Class<com.razerzone.store.sdk.engine.adobeair.RazerSDKNativeContext>

07-08 09:25:07.025 15689 15689 W System.err: java.lang.NoClassDefFoundError: com.razerzone.store.sdk.engine.adobeair.RazerSDKNativeContext

07-08 09:25:07.026 15689 15689 W System.err:    at com.razerzone.store.sdk.engine.adobeair.RazerSDKNativeExtension.createContext(RazerSDKNativeExtension.java:29)

07-08 09:25:07.026 15689 15689 W System.err:    at com.adobe.air.Entrypoints.EntryMainWrapper(Native Method)

timgraupmann
Participating Frequently
July 8, 2016

I was able to combine a set of JAR and AAR files into a single JAR and package within the ANE native extension.

Upon publishing I ran into this build error that I'm working through.

Question: Is there a log file in Adobe Animate to see the full error message? Adobe Air Android compile logs are too long to appear in the publishing failed dialog. It's been truncated!

---------------------------

Adobe Animate

---------------------------

Error creating files.

Warning: Application has not specified its permission requirements in application.xml

dx tool failed:warning: Ignoring InnerClasses attribute for an anonymous inner class

(alitvsdk.ad) that doesn't come with an

associated EnclosingMethod attribute. This class was probably produced by a

compiler that did not target the modern .class file format. The recommended

solution is to recompile the class from source, using an up-to-date compiler

and without specifying any "-target" type options. The consequence of ignoring

this warning is that reflective operations on this class will incorrectly

indicate that it is *not* an inner class.

warning: Ignoring InnerClasses attribute for an anonymous inner class

(alitvsdk.ae) that doesn't come with an

associated EnclosingMethod attribute. This class was probably produced by a

compiler that did not target the modern .class file format. The recommended

solution is to recompile the class from source, using an up-to-date compiler

and without specifying any "-target" type options. The consequence of ignoring

this warning is that reflective operations on this class will incorrectly

indicate that it is *not* an inner class.

warning: Ignoring InnerClasses attribute for an anonymous inner class

(alitvsdk.af) that doesn't come with an

associated EnclosingMethod attribute. This class was probably produced by a

compiler that did not target the modern .class file format. The recommended

solution is to recompile the class from source, using an up-to-date compiler

and without specifying any "-target" type options. The consequence of ignoring

this warning is that reflective operations on this class will incorrectly

indicate that it is *not* an inner class.

warning: Ignoring InnerClasses attribute for an anonymous inner class

(alitvsdk.ah) that doesn't come with an

associated EnclosingMethod attribute. This class was probably produced by a

compiler that did not target the modern .class file format. The recommended

solution is to recompile the cl

---------------------------

OK 

---------------------------

timgraupmann
Participating Frequently
July 8, 2016

For now to deal with exceptionally long log messages, I have to manipulate the combined JAR file adding/removing classes to fix warnings/errors.

I would prefer seeing the long log is it would show the DX error that's causing the duplicate or missing class file.

---------------------------

Adobe Animate

---------------------------

Error creating files.

dx tool failed:warning: Ignoring InnerClasses attribute for an anonymous inner class

(com.e.a.e.c) that doesn't come with an

associated EnclosingMethod attribute. This class was probably produced by a

compiler that did not target the modern .class file format. The recommended

solution is to recompile the class from source, using an up-to-date compiler

and without specifying any "-target" type options. The consequence of ignoring

this warning is that reflective operations on this class will incorrectly

indicate that it is *not* an inner class.

UNEXPECTED TOP-LEVEL EXCEPTION:

com.android.dx.cf.iface.ParseException: bad class file magic (cafebabe) or version (0034.0000)

  at com.android.dx.cf.direct.DirectClassFile.parse0(DirectClassFile.java:472)

  at com.android.dx.cf.direct.DirectClassFile.parse(DirectClassFile.java:406)

  at com.android.dx.cf.direct.DirectClassFile.parseToInterfacesIfNecessary(DirectClassFile.java:388)

  at com.android.dx.cf.direct.DirectClassFile.getMagic(DirectClassFile.java:251)

  at com.android.dx.command.dexer.Main.processClass(Main.java:709)

  at com.android.dx.command.dexer.Main.processFileBytes(Main.java:678)

  at com.android.dx.command.dexer.Main.access$300(Main.java:83)

  at com.android.dx.command.dexer.Main$1.processFileBytes(Main.java:607)

  at com.android.dx.cf.direct.ClassPathOpener.processArchive(ClassPathOpener.java:284)

  at com.android.dx.cf.direct.ClassPathOpener.processOne(ClassPathOpener.java:166)

  at com.android.dx.cf.direct.ClassPathOpener.process(ClassPathOpener.java:144)

  at com.android.dx.command.dexer.Main.processOne(Main.java:637)

  at com.android.dx.command.dexer.Main.processAllFiles(Main.java:511)

  at com.android.dx.command.dexer.Main.runMonoDex(Main.java:281)

  at com.android.dx.command.dexer.Main.run(Main.java:247)

  at com.android.dx.command.dexer.Main.main(Main.java:215)

  at com.android.dx.command.Main.main(Main.java:106)

...while parsing com/razerzone/store/sdk/engine/adobeair/DebugInput.class

1 error; a

---------------------------

OK  

---------------------------