Highlighted

Problem Create ANE,ArgumentError: Error #3500: The extension context does not have a method with the name

New Here ,
Sep 28, 2014

Copy link to clipboard

Copied

I little confuse about build ANE, I already follow all the direction, but the error always #3500 when I try to call the ANE.

I create ANE using java android.

The tools I use : Flash Builder running on Win-64 win.7. I think I must straight to the point, here what i made it first step by step;

1. I create the JAVA application first, with package senigo.extension.android then I create 3 file, Sample.java, SampleContext.java, PassTextFunction.java

2.pngsdf.png

Sample.Java Source Code

package senigo.extension.android;

import android.util.Log;

import com.adobe.fre.FREContext;

import com.adobe.fre.FREExtension;

public class Sample implements FREExtension {

  @Override

  public FREContext createContext(String arg0) {

  // TODO Auto-generated method stub

  Log.i("Sample", "createContext");

  return new SampleContext();

  }

  @Override

  public void dispose() {

  // TODO Auto-generated method stub

  Log.i("Sample", "Dispose");

  }

  @Override

  public void initialize() {

  // TODO Auto-generated method stub

  Log.i("Sample", "Initialize");

  }

}

SampleContext.Java Source Code

package senigo.extension.android;

import java.util.HashMap;

import java.util.Map;

import android.util.Log;

import com.adobe.fre.FREContext;

import com.adobe.fre.FREFunction;

public class SampleContext extends FREContext {

  public SampleContext()

  {

  Log.i("SampleContext", "constructor");

  }

  @Override

  public void dispose() {

  // TODO Auto-generated method stub

  Log.i("SampleContext", "dispose");

  }

  @Override

  public Map<String, FREFunction> getFunctions() {

  // TODO Auto-generated method stub

  Log.i("SampleContext", "getFunctions");

  Map<String, FREFunction> functionMap = new HashMap<String, FREFunction>();

  functionMap.put("passText", new PassTextFunction());

  return functionMap;

  }

}

PassTextFunction.Java Source Code

package senigo.extension.android;

import com.adobe.fre.FREContext;

import com.adobe.fre.FREExtension;

import com.adobe.fre.FREFunction;

import com.adobe.fre.FREObject;

public class PassTextFunction implements FREFunction {

  @Override

  public FREObject call(FREContext arg0, FREObject[] arg1) {

  // TODO Auto-generated method stub

  FREObject result = null;

  try{

  result =  FREObject.newObject("Hello World");

  }catch(Exception e)

  {

  }

  return result;

  }

}

after all the file I create the jar file using click right on the tree view >> Export >> Jar File >> Sample.Jar (i already create jar file that just contain the src folder and after i frustrated, i create .jar file contain all the whole project folder but still didn't work out).

Ok, After that I create project Flex Library Project, That's contain the actionscript to call the native and the extension.xml, here the code.

3.png

Test.as Source Code, FYI : i already create public function and the static function the error still same #3500.

package senigo.extension.android

{

  import flash.external.ExtensionContext;

  public class test

  {

  private static var extContext:ExtensionContext = null;

  public function test()

  {

  trace ("Test Constructor");

  if (!extContext)

  {

  initExtension();

  }

  }

  public static function get passText():String

  {

  trace ("Test Pass Text");

  if (!extContext)

  {

  initExtension();

  }

  return extContext.call("passText") as String;

  }

  private static function initExtension():void

  {

  trace ("Vibration Constructor: Create an extension context");

  extContext = ExtensionContext.createExtensionContext("senigo.extension.android", null);

  }

  }

}

extension.xml source code

FYI: in Flex when i put the Native Extension, they said must have Windows-x86 so I already create 3 ANE, that just contain Android-ARM , Contain Android-ARM and Default, Contain Android-ARM,Default and Windows-x86 but the error still same. I didn't got it where is the error.

<extension xmlns="http://ns.adobe.com/air/extension/3.1">

  <id>senigo.extension.android</id>

  <versionNumber>1.0.0</versionNumber>

  <platforms>

  <platform name="Android-ARM">

  <applicationDeployment>

  <nativeLibrary>Sample.jar</nativeLibrary>

  <initializer>senigo.extension.android.Sample</initializer>

  <finalizer>senigo.extension.android.Sample</finalizer>

  </applicationDeployment>

  </platform>

  <!-- <platform name="Windows-x86">

  <applicationDeployment>

  <nativeLibrary>sample.jar</nativeLibrary>

  <initializer>senigo.extension.android.Sample</initializer>

  <finalizer>senigo.extension.android.Sample</finalizer>

  </applicationDeployment>

  </platform>

  -->

   <platform name="default">

<applicationDeployment/>

</platform>

  </platforms>

</extension>

After I create it, I copy the .swc file and extension file sample with the Sample.jar file.

I extract the .swc file, copy the library.swf to folder Android-ARM,Default,Windows-86 and I create build.bat that contain the command like this

adt -package  -storetype PKCS12 -keystore senigo.p12 -storepass l10nk1ng -target ane senigo.extension.android.ane extension.xml -swc AndroidLib.swc -platform Android-ARM -C ./Android-ARM/ . -platform default -C ./default/ .

the I put the ane to Flex mobile project that I created:

4.png5.png

6.png

7.png

I run it but got error #3500, I really confuse?? what's wrong with my code? is there something I wrong or I Miss it?

Please any one help me.. and when is already ane file can I debug it in Flex Mobile Project? I wanna looks the log.i code that i wrote but i confuse how to looking up in flash builder.

at the end, I wanna said Sorry if my english not very goods, and thanks, because wanna see my problem and thank you very much if You can gave me a solution's

So you mean that test.as I created is belonging to android?

Exactly.

ok, if that so why when I put build ANE that's just contain Android-ARM, the error still show up?

Because when you launch application on Windows AIR Runtime use default implementation in this case. But looks like default implementation you use the same for Android and default.

is there I need to put Windows-86 to run it on windows?

If you create application/ANE for mobile platforms you don't need it.

I must use other actionscript that didn't content ExtensionContext?

Exactly!

For example, look at this: mesmotronic/air-fullscreen-ane · GitHub

fullscreen-ane-android folder - Android implementation

fullscreen-ane-default - default implementation (for all others platforms exclude Android)

It's a great example. It's pretty simple, you understand how it works.

TOPICS
Development

Views

1.5K

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more

Problem Create ANE,ArgumentError: Error #3500: The extension context does not have a method with the name

New Here ,
Sep 28, 2014

Copy link to clipboard

Copied

I little confuse about build ANE, I already follow all the direction, but the error always #3500 when I try to call the ANE.

I create ANE using java android.

The tools I use : Flash Builder running on Win-64 win.7. I think I must straight to the point, here what i made it first step by step;

1. I create the JAVA application first, with package senigo.extension.android then I create 3 file, Sample.java, SampleContext.java, PassTextFunction.java

2.pngsdf.png

Sample.Java Source Code

package senigo.extension.android;

import android.util.Log;

import com.adobe.fre.FREContext;

import com.adobe.fre.FREExtension;

public class Sample implements FREExtension {

  @Override

  public FREContext createContext(String arg0) {

  // TODO Auto-generated method stub

  Log.i("Sample", "createContext");

  return new SampleContext();

  }

  @Override

  public void dispose() {

  // TODO Auto-generated method stub

  Log.i("Sample", "Dispose");

  }

  @Override

  public void initialize() {

  // TODO Auto-generated method stub

  Log.i("Sample", "Initialize");

  }

}

SampleContext.Java Source Code

package senigo.extension.android;

import java.util.HashMap;

import java.util.Map;

import android.util.Log;

import com.adobe.fre.FREContext;

import com.adobe.fre.FREFunction;

public class SampleContext extends FREContext {

  public SampleContext()

  {

  Log.i("SampleContext", "constructor");

  }

  @Override

  public void dispose() {

  // TODO Auto-generated method stub

  Log.i("SampleContext", "dispose");

  }

  @Override

  public Map<String, FREFunction> getFunctions() {

  // TODO Auto-generated method stub

  Log.i("SampleContext", "getFunctions");

  Map<String, FREFunction> functionMap = new HashMap<String, FREFunction>();

  functionMap.put("passText", new PassTextFunction());

  return functionMap;

  }

}

PassTextFunction.Java Source Code

package senigo.extension.android;

import com.adobe.fre.FREContext;

import com.adobe.fre.FREExtension;

import com.adobe.fre.FREFunction;

import com.adobe.fre.FREObject;

public class PassTextFunction implements FREFunction {

  @Override

  public FREObject call(FREContext arg0, FREObject[] arg1) {

  // TODO Auto-generated method stub

  FREObject result = null;

  try{

  result =  FREObject.newObject("Hello World");

  }catch(Exception e)

  {

  }

  return result;

  }

}

after all the file I create the jar file using click right on the tree view >> Export >> Jar File >> Sample.Jar (i already create jar file that just contain the src folder and after i frustrated, i create .jar file contain all the whole project folder but still didn't work out).

Ok, After that I create project Flex Library Project, That's contain the actionscript to call the native and the extension.xml, here the code.

3.png

Test.as Source Code, FYI : i already create public function and the static function the error still same #3500.

package senigo.extension.android

{

  import flash.external.ExtensionContext;

  public class test

  {

  private static var extContext:ExtensionContext = null;

  public function test()

  {

  trace ("Test Constructor");

  if (!extContext)

  {

  initExtension();

  }

  }

  public static function get passText():String

  {

  trace ("Test Pass Text");

  if (!extContext)

  {

  initExtension();

  }

  return extContext.call("passText") as String;

  }

  private static function initExtension():void

  {

  trace ("Vibration Constructor: Create an extension context");

  extContext = ExtensionContext.createExtensionContext("senigo.extension.android", null);

  }

  }

}

extension.xml source code

FYI: in Flex when i put the Native Extension, they said must have Windows-x86 so I already create 3 ANE, that just contain Android-ARM , Contain Android-ARM and Default, Contain Android-ARM,Default and Windows-x86 but the error still same. I didn't got it where is the error.

<extension xmlns="http://ns.adobe.com/air/extension/3.1">

  <id>senigo.extension.android</id>

  <versionNumber>1.0.0</versionNumber>

  <platforms>

  <platform name="Android-ARM">

  <applicationDeployment>

  <nativeLibrary>Sample.jar</nativeLibrary>

  <initializer>senigo.extension.android.Sample</initializer>

  <finalizer>senigo.extension.android.Sample</finalizer>

  </applicationDeployment>

  </platform>

  <!-- <platform name="Windows-x86">

  <applicationDeployment>

  <nativeLibrary>sample.jar</nativeLibrary>

  <initializer>senigo.extension.android.Sample</initializer>

  <finalizer>senigo.extension.android.Sample</finalizer>

  </applicationDeployment>

  </platform>

  -->

   <platform name="default">

<applicationDeployment/>

</platform>

  </platforms>

</extension>

After I create it, I copy the .swc file and extension file sample with the Sample.jar file.

I extract the .swc file, copy the library.swf to folder Android-ARM,Default,Windows-86 and I create build.bat that contain the command like this

adt -package  -storetype PKCS12 -keystore senigo.p12 -storepass l10nk1ng -target ane senigo.extension.android.ane extension.xml -swc AndroidLib.swc -platform Android-ARM -C ./Android-ARM/ . -platform default -C ./default/ .

the I put the ane to Flex mobile project that I created:

4.png5.png

6.png

7.png

I run it but got error #3500, I really confuse?? what's wrong with my code? is there something I wrong or I Miss it?

Please any one help me.. and when is already ane file can I debug it in Flex Mobile Project? I wanna looks the log.i code that i wrote but i confuse how to looking up in flash builder.

at the end, I wanna said Sorry if my english not very goods, and thanks, because wanna see my problem and thank you very much if You can gave me a solution's

So you mean that test.as I created is belonging to android?

Exactly.

ok, if that so why when I put build ANE that's just contain Android-ARM, the error still show up?

Because when you launch application on Windows AIR Runtime use default implementation in this case. But looks like default implementation you use the same for Android and default.

is there I need to put Windows-86 to run it on windows?

If you create application/ANE for mobile platforms you don't need it.

I must use other actionscript that didn't content ExtensionContext?

Exactly!

For example, look at this: mesmotronic/air-fullscreen-ane · GitHub

fullscreen-ane-android folder - Android implementation

fullscreen-ane-default - default implementation (for all others platforms exclude Android)

It's a great example. It's pretty simple, you understand how it works.

TOPICS
Development

Views

1.5K

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Sep 28, 2014 0
Engaged ,
Sep 28, 2014

Copy link to clipboard

Copied

Why you comment Windows-x86 in your extension.xml ?

I think that is a problem. You launch your application on Windows but ANE haven't got Windows-x86 implementation (also you don't include it while packaging). So your application use default implementation. But default implementation don't use any native code and cannot use ExtensionContext. And you got error.

If you don't need Windows-x86 native implementation than you need implement default implementation that different than Android-ARM. You don't need to use ExtensionContext in default implementation.

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Reply
Loading...
Sep 28, 2014 0
New Here ,
Sep 28, 2014

Copy link to clipboard

Copied

Alex Rekish wrote:

Why you comment Windows-x86 in your extension.xml ?

I think that is a problem. You launch your application on Windows but ANE haven't got Windows-x86 implementation (also you don't include it while packaging). So your application use default implementation. But default implementation don't use any native code and cannot use ExtensionContext. And you got error.

If you don't need Windows-x86 native implementation than you need implement default implementation that different than Android-ARM. You don't need to use ExtensionContext in default implementation.

Thanks for you answer Alex Rekish, Sorry I didn't screen shoot all about the extension.xml. I comment it because the latest ANE that I build is contain Android-ARM and default. so I commented. but I already try it using just ANE that's just contain Android-ARM, with Android-ARM and windows-x86,and Android-ARM, and default, and Android-ARM,default,Windows-x86 the error still the same.

here the screen shoot, I embeded the ane that's i contain Windows-x86

new1.png

in action script test.as I didn't change it anythings, I just play it on extension.xml to build the ane. is there any mistake over there? I interact with your answer that "If you don't need Windows-x86 native implementation than you need implement default implementation that different than Android-ARM. You don't need to use ExtensionContext in default implementation." I didn't need to user ExtensionContext? is means? in the actionscript? or in extension.xml? can you explained

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Reply
Loading...
Sep 28, 2014 0
Engaged ,
Sep 28, 2014

Copy link to clipboard

Copied

Your default implementation is just AS3 code without any native code. So you cannot use ExtensionContext in default.swf/default.swc

You already have senigo.extension.android.test AS3 class for Android. You need to create another one for default. It will be different. Don't use ExtensionContext in it, just AS3 code.

Then put it to default folder as usually and package ANE again.


Another words: you can't use Android implementation on Windows. On Windows (if you don't have Windows-x86 implementation) AIR Runtime use default implementation that cannot call any native code (cannot use ExtensionContext), just AS3 code.

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Reply
Loading...
Sep 28, 2014 0
Engaged ,
Sep 28, 2014

Copy link to clipboard

Copied

Maybe here it's explained more clearly (The Default Library): Building a Native Extension Part 2 – The ActionScript Code | Digital Primates

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Reply
Loading...
Sep 28, 2014 0
New Here ,
Sep 28, 2014

Copy link to clipboard

Copied

Alex Rekish wrote:

Your default implementation is just AS3 code without any native code. So you cannot use ExtensionContext in default.swf/default.swc

You already have senigo.extension.android.test AS3 class for Android. You need to create another one for default. It will be different. Don't use ExtensionContext in it, just AS3 code.

Then put it to default folder as usually and package ANE again.


Another words: you can't use Android implementation on Windows. On Windows (if you don't have Windows-x86 implementation) AIR Runtime use default implementation that cannot call any native code (cannot use ExtensionContext), just AS3 code.

Thanks For the answer Alex, So you mean that test.as I created is belonging to android? ok, if that so why when I put build ANE that's just contain Android-ARM, the error still show up? is there I need to put Windows-86 to run it on windows?

If that true, so for Windows-x86 I must use other actionscript that didn't content ExtensionContext? or In test.as actionscript I must tell if the platform is windows-x86 so I not use ExtensionContext? but how can I do that? could you gave me a sample? it will be nice thank's

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Reply
Loading...
Sep 28, 2014 0
Engaged ,
Sep 28, 2014

Copy link to clipboard

Copied

So you mean that test.as I created is belonging to android?

Exactly.

ok, if that so why when I put build ANE that's just contain Android-ARM, the error still show up?

Because when you launch application on Windows AIR Runtime use default implementation in this case. But looks like default implementation you use the same for Android and default.

is there I need to put Windows-86 to run it on windows?

If you create application/ANE for mobile platforms you don't need it.

I must use other actionscript that didn't content ExtensionContext?

Exactly!

For example, look at this: mesmotronic/air-fullscreen-ane · GitHub

fullscreen-ane-android folder - Android implementation

fullscreen-ane-default - default implementation (for all others platforms exclude Android)

It's a great example. It's pretty simple, you understand how it works.

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Reply
Loading...
Sep 28, 2014 0
New Here ,
Sep 28, 2014

Copy link to clipboard

Copied

ayamg0r3ng wrote:

Alex Rekish wrote:

Your default implementation is just AS3 code without any native code. So you cannot use ExtensionContext in default.swf/default.swc

You already have senigo.extension.android.test AS3 class for Android. You need to create another one for default. It will be different. Don't use ExtensionContext in it, just AS3 code.

Then put it to default folder as usually and package ANE again.


Another words: you can't use Android implementation on Windows. On Windows (if you don't have Windows-x86 implementation) AIR Runtime use default implementation that cannot call any native code (cannot use ExtensionContext), just AS3 code.

Thanks For the answer Alex, So you mean that test.as I created is belonging to android? ok, if that so why when I put build ANE that's just contain Android-ARM, the error still show up? is there I need to put Windows-86 to run it on windows?

If that true, so for Windows-x86 I must use other actionscript that didn't content ExtensionContext? or In test.as actionscript I must tell if the platform is windows-x86 so I not use ExtensionContext? but how can I do that? could you gave me a sample? it will be nice thank's

Thanks Alex, I got it now, I miss the concepts, I thought ANE can run in device emulator on adobe, so it's just can run on the device... LOL... I need to repair first my Android,to check it run it or not, but I think maybe it will solve the problem, I think it will.. Thanks for the answer.. I been find out about 2 weeks LOL. I thought I doing something wrong.. Many Thanks from me to you my friend ^^

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Reply
Loading...
Sep 28, 2014 0