Skip to main content
Participant
September 28, 2014
Answered

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

  • September 28, 2014
  • 1 reply
  • 2518 views

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

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.

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:

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

This topic has been closed for replies.
Correct answer itlancer

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


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.

1 reply

itlancer
Inspiring
September 28, 2014

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.

Participant
September 28, 2014

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

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

itlancer
Inspiring
September 28, 2014

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.