I've been trying to build a Native Extension in Adobe AIR for Android and stumbled across some issues. Looks like something is wrong with the configuration or the steps I take to build it.
I've created an ANEBoilerplate project so I can get down to the very basis of the problem. Here is the test code I use for it:
package
{
import com.tomasz.boilerplate.BoilerplateAS;
import flash.display.Sprite;
import flash.display.StageAlign;
import flash.display.StageScaleMode;
public class BoilerplateTest extends Sprite
{
public function BoilerplateTest()
{
super();
// support autoOrients
stage.align = StageAlign.TOP_LEFT;
stage.scaleMode = StageScaleMode.NO_SCALE;
var ane:BoilerplateAS = new BoilerplateAS();
}
}
And here is the source of my AS3 side of the ANE [BoilerplateAS.as]:
package com.tomasz.boilerplate
{
import flash.events.EventDispatcher;
import flash.external.ExtensionContext;
public class BoilerplateAS extends EventDispatcher
{
private var _extContext:ExtensionContext;
public function BoilerplateAS()
{
super();
_extContext = ExtensionContext.createExtensionContext("com.tomasz.boilerplate", "");
if(!_extContext) {
throw new Error("Boilerplate native extension is not supported on this platform.");
}
}
}
}
The problem is I get _extContext equal null.
Here is my extension.xml:
<extension xmlns="http://ns.adobe.com/air/extension/19.0">
<id>com.tomasz.boilerplate</id>
<versionNumber>1</versionNumber>
<platforms>
<platform name="Android-ARM">
<applicationDeployment>
<nativeLibrary>classes.jar</nativeLibrary>
<initializer>com.tomasz.boilerplate.MainActivity</initializer>
<finalizer>com.tomasz.boilerplate.MainActivity</finalizer>
</applicationDeployment>
</platform>
</platforms>
</extension>
And here is the structure of my extension directory:
And this is how I compile the ANE:
adt -package -target ane Boilerplate.ane extension.xml -swc BoilerplateAS.swc -platform Android-ARM -C Android-ARM .
I've been doing this on OSX with JDK 1.7.0_79 and using Adobe AIR 21 and Adobe AIR 19. I had the same issue with both of them. I also tried compiling with JDK 1.8.0_91 but still the same problem. JDK 1.6 is not viable because I need the Android features from newer SDKs.
Can somebody tell me what I might be doing wrong? Can somebody compile this source and use it? I'd be grateful for any help.
