Log in or register to post comments

Vuforia AIR Native Extension

November 20, 2012 - 2:13am #46

Vuforia AIR Native Extension

November 21, 2012 - 7:00am #45

Hi, what version of Vuforia are you using ?

also, what Android version ?


Vuforia AIR Native Extension

November 21, 2012 - 8:04am #44

Vuforia: vuforia-sdk-android-1-5-9
Android: 2.3.5
Device: HTC Desire HD

Vuforia AIR Native Extension

November 21, 2012 - 8:52am #43

thanks for the information; that allows me to exclude some possible issues affecting the setInitParameters() in older version of Vuforia when running on ICS.

In your case, everything is fine on that side.

Hard to tell then what can make it fail with AIR;

one thing you can try is to see if using OpenGL ES 1.1 (instead of 2.0) could fix the issue.

If you look at the ImageTargets sample Android.mk file, you will see that you can switch OpenGL ES 2.0 with 1.1; then you need to rebuild the native code and refresh the  project in Eclipse and see what happens at runtime.


Vuforia AIR Native Extension

November 22, 2012 - 11:05am #42

I did what you suggested. While doing it, I realised I forgot to init mQCARFlags.
Could be a problem I'm not making the calls from an Activity?
I'm trying to pass exernalContext.getActivity() to the setInitParameters because using a ArTest.this (like ImageTargets.this in the samples), because this is not an Activity class.

11-22 19:44:06.390: D/ArTest(10574): APPSTATUS_INIT_APP

11-22 19:44:06.390: D/ArTest(10574): initApplication

11-22 19:44:06.390: D/ArTest(10574): APPSTATUS_INIT_QCAR

11-22 19:44:06.400: D/ArTest(10574): value of getOpenGlEsVersionNative(): 2

11-22 19:44:06.400: D/ArTest(10574): try QCAR.setInitParameters()

11-22 19:44:06.440: D/ArTest(10574): createContext java part init

11-22 19:44:06.440: W/dalvikvm(10574): threadid=13: thread exiting with uncaught exception (group=0x4001d5a0)

11-22 19:44:06.490: E/AndroidRuntime(10574): FATAL EXCEPTION: AsyncTask #1

11-22 19:44:06.490: E/AndroidRuntime(10574): java.lang.RuntimeException: An error occured while executing doInBackground()

11-22 19:44:06.490: E/AndroidRuntime(10574): at android.os.AsyncTask$3.done(AsyncTask.java:200)

11-22 19:44:06.490: E/AndroidRuntime(10574): at java.util.concurrent.FutureTask$Sync.innerSetException(FutureTask.java:274)

11-22 19:44:06.490: E/AndroidRuntime(10574): at java.util.concurrent.FutureTask.setException(FutureTask.java:125)

11-22 19:44:06.490: E/AndroidRuntime(10574): at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:308)

11-22 19:44:06.490: E/AndroidRuntime(10574): at java.util.concurrent.FutureTask.run(FutureTask.java:138)

11-22 19:44:06.490: E/AndroidRuntime(10574): at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1088)

11-22 19:44:06.490: E/AndroidRuntime(10574): at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:581)

11-22 19:44:06.490: E/AndroidRuntime(10574): at java.lang.Thread.run(Thread.java:1027)

11-22 19:44:06.490: E/AndroidRuntime(10574): Caused by: java.lang.NullPointerException

11-22 19:44:06.490: E/AndroidRuntime(10574): at mv.ar.ArTest$InitQCARTask.doInBackground(ArTest.java:257)

11-22 19:44:06.490: E/AndroidRuntime(10574): at mv.ar.ArTest$InitQCARTask.doInBackground(ArTest.java:1)

11-22 19:44:06.490: E/AndroidRuntime(10574): at android.os.AsyncTask$2.call(AsyncTask.java:185)

11-22 19:44:06.490: E/AndroidRuntime(10574): at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:306)

11-22 19:44:06.490: E/AndroidRuntime(10574): ... 4 more

When I pass null instead of Activity, it continues normaly, but it displays:
11-22 19:56:39.805: E/AR(10767): Error - failed to assert required Android permissions. Failed to initialize QCAR SDK. All required Android permissions must be included for the SDK to work.
I have this permissions included:
<uses-sdk android:minSdkVersion="8" />
<uses-sdk android:targetSdkVersion="8" />
<uses-feature android:name="android.hardware.camera" />
<uses-feature android:required="true" android:name="android.hardware.touchscreen.multitouch" />
<uses-permission android:name="android.permission.CAMERA" />
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.READ_PHONE_STATE" />
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.ACCESS_WIFI_STATE" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />

Vuforia AIR Native Extension

November 23, 2012 - 12:44am #41

Hi, setting the mQCARflags is a fundamental step, as it allows QCAR to know if you are using OpenGL ES 1.1 or 2.0, so you must set it of course before getting to the setInitParmaters.

For what concerns which activity to pass as first argument to the setInitParameters() function,  this must be the Activity in which the GLSurfaceView used by QCAR will be shown (i.e. in practice, the activity onto which the QCAR GL view is added by using either setContentView or addContentView).


Vuforia AIR Native Extension

November 25, 2012 - 3:54am #40

I tried what you have suggested but it still throws the same error as before.
I guess I won't be able to do what I want with current API.

What is the reasoning for passing an activity to setInitParameters?
Let's say I won't be using GLSurfaceView at all. I just want to use you fast image tracking to get a projection matrix. Can it be done?

Vuforia AIR Native Extension

November 27, 2012 - 2:27am #39

Hi, the reason for passing the activity parameter to qcar init is that QCAR will store some low-level information on the activity; this is really about low level details of QCAR impleemntation I cannot describe here.

However, regarding your question, is it possible to avoid the GLSurfaceView and use QCAR without the OpenGL rendering part, the answer is yes;

to confirm that I made a quick test, starting from ImageTargets sample; there I removed from the ImageTargets.java all the code related to mGLView and the mRenderer (basically just remove all lines of code where mGLView or mRenderer appear).

At the same time, in the ImageTargets.cpp native code, I added these lines of code in the QCAR_onUpdate() method

(these are usually located inside the _renderFrame function, but the _renderFrame function is no longer called, as I removed mGLView in Java):


       LOG("====== QCAR_onUpdate() ======");

    QCAR::State state = QCAR::Renderer::getInstance().begin();


    // Did we find any trackables this frame?

    for(int tIdx = 0; tIdx < state.getNumActiveTrackables(); tIdx++)


            // Get the trackable:

            const QCAR::Trackable* trackable = state.getActiveTrackable(tIdx);

            QCAR::Matrix44F modelViewMatrix =



            LOG("Trackable Pose");






The printMatrix function actually logged the matrix values  of the trackable Pose whenever I was aiming the device to the Stones or Chips printed target, proving that it was working all right.

So, yes, you can use QCAR without the OpenGL rendering part, however you need to initialize it correctly;

for the AIR specific issue, I cannot help directly,

however,  have you tried passing your Main Activity (whatever such activity is) to QCAR.setInitParameters ?


Vuforia AIR Native Extension

November 27, 2012 - 3:57am #38

About the main activity...

I usually called context.getActivity() thru FREContext. This should get the main activity as far as I know. I could be wrong.
When I pass it to setInitParameters, it throws a signal 11 error.

Not using OpenGL for rendering is great news. 
Thank you for your help.


Vuforia AIR Native Extension

November 27, 2012 - 4:40am #37

One extra note:

I searched the internet and found many forums discussing a similar crash (signal 11 etc.) occurring with Adobe AIR on Android in various circumstances, here is an example (but you can find many others):


in the thread above, they say the following (if it can help):

Update: I was able to get logcat working using ADB from the command line. Unfortunately only one of the devices I'm currently testing is rooted, and able to do this.

F/libc ( 1788): Fatal signal 11 (SIGSEGV) at 0x00000000 (code=1)

Here's a link to the full log http://pastebin.com/uhuMP5VP

This is Android 4.0.4 on an ARMv7rev2 1GHz (sun4i) device with Air and Mali-400 MP graphics. Again, the app crashes after no more than a few seconds of black when direct or GPU mode are used, and works seemingly fine when "auto" (CPU) is used.


Any luck with the extension?

December 21, 2012 - 12:57pm #36

Any luck with the extension?   I am also thinking about created an AIR extension, if time permits. :)

If markovidmar or anyone in

December 24, 2012 - 1:57am #35

If markovidmar or anyone in the Forum has done some progress with integration of Adobe AIR to share here,

he is welcome to share it !!


I made some progress

December 24, 2012 - 2:21am #34

I'm glad someone else is interested in this project. And I've made some progress creating the extension.

The fatal signal 11 was happening because the fuction for getting the activity was returning null, which was weird, because I was instantiating it on the air side through the extension when air app was loaded. I fixed that by creating the button to run the extension therefore no fatal signal 11 which will probably be the way it will be run.

The extension detects just fine (I can see the LogCat debug info containing the data).

The problem I'm trying to solve right now is an efficient way to send image data from the camera frame to flash.
The current way I do that is very unefficient. (I'm getting about 12fp with away3d background texture which is not good enough).

I was thinking of sharing the demo, when it's complete.
Also, the code is a mess. I'll try to do some refactoring beforehand with comments for easier understanding.

Be patient. I'll try to post it in a week or two due to holidays and all...


Awesome that you have made

December 26, 2012 - 3:00pm #33

Awesome that you have made good progress.  I have been a flash developer/designer for many years now and I had recently started my own AR engine in AS3, but like most others, I have found that it is way too slow to make the calculations on the AIR side.  The main image recognition and orientation code need to be native.

I was wondering, though, why you are sending the image data to flash?  I was thinking that it perhaps would be most effecient to just send the translation matrix to flash.  Let the native code do the image recognition and tracking and have flash take care of all the visuals, and 3d objects.   I am perhaps not reading your post correctly,  so forgive me.  Perhaps you have discovered that it needs to be done that way from experience or such.

I look forward to seeing this project grow :)





Perhaps you know something I don't

December 27, 2012 - 2:12am #32

I'm kind of new to Java and C++ programing.
So there is a lot of things I don't know and I need to gain more knowledge.

Why am I sending the image to flash?  I have to display the camera background in AIR somehow.
Vuforia is using the native camera for the detection. I guess I thought I can't use the camera when it's already being used.
(Read the first two sentances of this reply again :D) I thought that was the way to go.

As for the projection matrixes (yes, I'll add multi target support in a single dataset) At least I don't have problems with detection.
I was thinking the data should be sent event based with matrix and id sent so we know which object to update.

Also, it will take time to migrate to new version of SDK (2.0). I have to experiment some more. I'll try to add GitHub as soon as I'm complete with the demo.


Since I have hardly

December 27, 2012 - 10:52am #31

Since I have hardly programmed in Java, Objective C, just started taking a look at this SDK, and has not done any native extensions, take what I say with a micro grain of salt :P

Can the native code take care of putting the camera image on the screen?  I have played with this extension by inspirit that did that.


Hope that helps.  Your work is greatly apprecaited and I am looking forward to getting up to speed enough to help :)



Guys, great to see that

December 28, 2012 - 2:31pm #30

Guys, great to see that you're making such good progress on the AIR side; I'm following your discussion with interest. 

Dev update

January 4, 2013 - 2:57am #29

I was unsuccessfully trying to send bitmapdata over jni from java to air. Too damn slow. 1-2 fps. I was so close to giving up, when I tried one last thig.
I went back to the ImageTarget sample. My line of though was - on Android, AIR uses GLES2, so a GL surface must exist. I then put GL rendering code back.

The flow:

onQCARupdate -> call a dispatchCameraUpdateEvent in java -> onUpdateEvent(if we add event listener to native extension, it fires.)

Ok, so far so good. The AIR side knows, when the update has been made, so what now?
I use Away3d 3d engine for flash. The problem is, when to call render in jni and how to change away3d render, so background won't be overwritten?

I modified the DefaultRenderer class in as3 and added a new variable renderNative:Function.
When onUpdateEvent fires for the first time, I change the draw function, so it will call render in jni through native extension. Only then will the content be drawn over it. Right? Wrong. Background gets cleared, so I must find a solution. So i changed the clear to include a white mask and to clear black transparent color in RendererBase class.

Result? Success. I'm getting about 60 fps.

TODO: sending projection matrix through, matrix transformations and 3d object updating.

Hi markovidmar, when you're

January 4, 2013 - 3:30am #28

Hi markovidmar, when you're done with your amazing work, it would be really great if you could post here a complete step-by-step solution (not the whole code, but just the process and a few relevant code snippets where appropriate); that would be very valuable for other possible Adobe AIR + Vuforia users.

Great job!


Fantastic!   Makes me feel a

January 7, 2013 - 7:31am #27

Fantastic!   Makes me feel a lot more optimistic about making the extension.  

Share what you can.

Vuforia + AIR + Away3d integration

January 13, 2013 - 6:41am #26

I'm currently editing the walkthrough of the process. 

Vuforia + AIR + Away3d integration

January 13, 2013 - 6:42am #25


Hi guys. I only have time to work on this project on weekends. I know I've been promising this for a long time. I'm asking for your patience here.
I managed to create a simple demo for the intergation but, there is still a lot of work to be done. The following walkthrough will look hacky because it is.
I'm currently editing the walkthrough of the process so I'll be updating it regulary.

What's the goal here? I wanted to create an AR app that can dynamically load data sets, dynamically load flash content using swf files and displaying it.
Why Vuforia, AIR and Away3d? Vuforia was chosen bacause of the speed and performance, handling multiple markers and recent, to create markers on the fly. Excelent. As3 code and Away3d I'm the most comfortable with because I'm a Flash developer and not Java or C++ developer. This was also the opportunity of getting to know other programing languages. Bridging the two together is a challenge and when I first saw Native Extensions for AIR I knew I had to do this.



I must note, I'm developing this on windows, so I can't help you how to set this up on Mac.
This are the tools i'm using for this project:

Java part: JDK, Android SDK (ADT Bundle) , Android NDK,  7-zip,
Flash part: Flash Develop (Flash develop should download Flex SDK and Air SDK during the install), Away3d 4.1 Alpha
Vuforia part: Vuforia SDK, Vuforia Samples (I'm using just ImageTarget and Dominoes for now).

2. Overview

I won't be explaining a lot about Native Extensions for AIR here. You can read the theory just like I did. All I learned about NE is there.
The point is to bring all the code together and create ANE file, that can be used inside of the projects.
In the following steps we'll be reusing Vuforia Sample code and modify it to work together with native extension that is written in Java.
C (using JNI)<--> Java <--> AIR

I wanted to use C++ code to work with AIR directly because we could do that.
C <--> AIR

The problem is Vuforia doesn't. Vuforia uses calls like QCAR.setInitParameters, QCAR.init, etc. that must be called from the Java side hence using Java as a mediator between the two.


Looks very promising...

January 13, 2013 - 2:58pm #24

Looks very promising...


January 14, 2013 - 4:19am #23

Sorry, I'll try to update as much as I can when I get home from work. I was busy yesterday and had to pause. Is there a way to edit old post?
Or should I create a new topic and post there?

Hi, the cleanest solution

January 14, 2013 - 4:22am #22

Hi, the cleanest solution would be to post a completely new Thread, where you put your entire guide in one single post;

from the current thread (here) we will then just put a link to the page where you posted the guide.



Any updates?

January 18, 2013 - 1:04am #21

I am very interested in this thread but since the last update is in october 2012 it seems that this project is nog longer under development. Or is it?

Hi wessel, if you look at the

January 18, 2013 - 1:09am #20

Hi wessel,

if you look at the posts below, you can see there has been several updates in the past weeks.

markovidar is the one who has the "big" expertise with this AIR extension, let's bear with him !


January 18, 2013 - 2:21am #19

This project is active and is working actually. For now the extension works as a ImageTarget Sample equivalent. For now...
The guide has been promissed and will be delivered. I will have free time this weekend to write it.

About the October thing. You are thinking about the Joined date - the date a person had joined the forum. It was confussing at the start, but you'll get used to it.
And the order of the posts are are: new on top, old at the bottom. Weird, I know. Still getting used to that, because every forum I was active at, didn't have this ordering.

I'm sorry about the stalling. I would of liked if I had more time on my hands, but I unfortunaly do not.



January 21, 2013 - 9:36am #18

Hi, guys.

I commited my project to GitHub:


I will add detailed instructions under wiki.

Feel free to comment, add suggestions, etc...

Vuforia AIR Native Extension

January 22, 2013 - 12:28am #17

Nice.  Wiki instructions will be welcome as well.

Vuforia AIR Native Extension

January 22, 2013 - 8:08am #16

The code looks really nice, I tried it and it worked perfectly. Many thanks :D !

Vuforia AIR Native Extension

January 24, 2013 - 6:25am #15

I tested the application again on a Asus Transformer Prime tablet and it didn't work. I only see the tarmac image at the center of the screen, the awayStats window is also there but it doesn't do antyhing besides that.

I think that your nativeRender mod on the DefaultRenderer class only works on certain devices

Vuforia AIR Native Extension

January 24, 2013 - 6:29am #14

Sorry. I forgot to mention. The tarmac image is actually a button. Double tap it, to run the demo. Sorry. I'll change the image into a button with the text Run.

Vuforia AIR Native Extension

January 30, 2013 - 10:33pm #13

very nice, is there a sample app for testing?

Vuforia AIR Native Extension

January 31, 2013 - 3:09am #12

There was a complete working app, but then I found out I was violating Terms Of Use (Licence Agreement).
I shouln't had done that, so I promptly removed it, so I don't get legal problems.

What I can do is a tutorial explaining the steps necessary to create a native extension yourself. 
I was thinking of posting it during the weekend. The only code I'll be posting is what I modified and not sample code, because of the reasons above.

Vuforia AIR Native Extension

May 14, 2013 - 11:11am #11

markovidmar, which part of Terms of Use it is violating?

As I understand, you can't publish sample's code anywhere. So, you can just replace Vuforia's code with yours and it will be nice.

Please can you publish your extension or tutorial?

Vuforia AIR Native Extension

June 20, 2013 - 8:49pm #10

Man, I was reading through this thread and got really excited until I saw that the code was taken down.  I hope to see more information regarding this at some point.  I'm mostly curious about performance and how well it can run.

Vuforia AIR Native Extension

August 14, 2013 - 7:33am #9

I'm so much excited to see this thread. But I don't know why the sample code is missing. Please help me or send any datumn to my mai box:

It's very emergent!!!

Vuforia AIR Native Extension

September 30, 2013 - 10:57pm #8

I was reading with so much excitement from the beginning! This is like a tragic movie with a sad ending.

I'm sure a lot of people on here would love to play around with Vuforia as ANE. I know I would. Maybe you could talk to the mods and figure a way around this? Really looking forward to this.

Vuforia AIR Native Extension

October 7, 2013 - 2:28pm #7

A while ago I have figured out how to use vuforia with adobe air. If there are enough people who want to have a tutorial on how to use vuforia as native extension I can write one. Unfortunately I don't have much time so it will take a while before it's online, but i'd love to hear if people are interested?

Vuforia AIR Native Extension

October 7, 2013 - 6:27pm #6

I would be far beyond interested in something like this.  Please let me know how far you get and if there's anything that might be blocking you.  Maybe I or people around here can help.

Vuforia AIR Native Extension

October 10, 2013 - 7:40am #5

wessel wrote:

A while ago I have figured out how to use vuforia with adobe air. If there are enough people who want to have a tutorial on how to use vuforia as native extension I can write one. Unfortunately I don't have much time so it will take a while before it's online, but i'd love to hear if people are interested?

wessel, I am most definitely interested and can think of atleast two more people who would be. Please do go ahead and put it up - we'd all be happy to learn and contribute.

Vuforia AIR Native Extension

October 11, 2013 - 6:20pm #4

You are my hero man!! I just can't wait any more!!!

Vuforia AIR Native Extension

February 4, 2014 - 8:55am #3

Any updates on this? I'd love to have a native extension for this!!

Vuforia AIR Native Extension

March 21, 2014 - 10:26am #2

I am also very interested, any information about that will be good!

Vuforia AIR Native Extension

January 22, 2016 - 2:16am #1

Hi, just came across this thread.  Has anyone had any luck in wrapping the SDKs up in an ANE?

Log in or register to post comments