04 November 2012

Understand Flex Build Packaging : Native Entensions message

After a bad experience with WP8, I came back to my current experiment : Native Extension.
I won't explain you what is an AIR Native Extension, look at the dedidacted page from Adobe but more how to read the message on the Native Extension property page.

I almost lost 2 hours because I didn't understand why the default and not the native extension was used so let me share with you how I fixed it and what I discovered at the same time.

When you want to include an ANE on your mobile/desktop AIR project, you first had to include it on Flex Build Path / Native extensions

Doing this, Flex checks the targets (at least 2 : default and 1 native) and  the AIR version needed.
If it's ok, it adds the extension ID on the app.xml even if, from what I read on the net but didn't check by myself) it seems it sometimes failed to do it...

On my current ANE, I only did default and android native at the moment.
So, Android Native will be used for Android deployment and Android on device debug while the default will be used for android simulator debug, desktop and any other devices deployment.

Well...it's what I thought (and read)...but in fact, there is another step to check.
I don't know if it's because I updated a lot my ANE or it wasn't done by default but, in fact, doing thing tell Flex to use the default (actionscript) extension anywhere.
So ALWAYS open the Flex Build Packaging property of your project and check the Native Extensions page.
By default, I discover the Package checkbox wasn't checked (again, I don't why and when it was unchecked but not by me !)

I so checked the Package checkbox and it finally used my native code, not my actionscript code.

I then wanted to check the iOS, using only actionscript code.
According asdoc, default is used for any platform without native code.
I checked the Package checkbox on the iOS part and got an strange red cross icon

I compared with Android part

If you read carefully, you'll see this on the iOS part
This ANE does not support iOS platform in red with a red cross icon (which usually means ERROR)
but, 4 lines after, you could also read
Apple iOS Supported : Yes

Errr...Supported or not ?!! Probably not since I have one big red cross icon !
In fact, you should read the first line as
This ANE does not support iOS platform NATIVELY
and the 4th line is correct.

In this case, the ANE doesn't include iOS native code but, since there is a valid default platform, iOS is supported.
Adobe added an Microsoft error (you know, error which is not an error)

So, always check if the Package checkbox is selected and don't take care of the icon.

No comments: