Emmett J. Butler Emmett J. Butler - 2 months ago 10x
ActionScript Question

Flex/ADL: Native methods are not allowed in loaded code

I'm attempting to run my AIR app under the ADL command line debugger including a third party native extension (I'm not using an IDE such as FlashDevelop). My app is intended for Windows desktop machines.

Compilation appears to work without issue:

$ amxmlc src/menustatemain.as
-o src/menustatemain.swf
-compiler.include-libraries C:\Users\Me\Downloads\AIRSDK_Compiler\frameworks\libs\player\21.0\playerglobal.swc
Loading configuration: C:\Users\Me\Downloads\AIRSDK_Compiler\frameworks\air-config.xml

3383030 bytes written to C:\Users\Me\Documents\myproject\src\menustatemain.swf in 17.069 seconds

However when I try to run the app under ADL, it fails with this error:

$ adl
-extdir extensions\ane_unzipped
-profile extendedDesktop
VerifyError: Error #1079: Native methods are not allowed in loaded code.

I've googled around and nothing I've tried has solved the issue. There are several similar questions on StackOverflow whose answers don't solve my issue. I have changed every setting I can find to dynamically link the extension at compile time and load it at runtime. I have a hunch this could be an issue with the extension itself, but I don't know how to verify that.

How can I debug this issue?

For context, this is the content of

<application xmlns="http://ns.adobe.com/air/application/21.0">

Also, I have the compiled and uncompiled versions of the native extension in a project subdirectory:



The issue was that I was using the wrong playerglobal.swc. The Flex SDK download comes with a "player" framework and an "AIR" framework, and I was incorrectly compiling against the "player" one, which doesn't allow native extensions. Changing my compile command did the trick:

-compiler.include-libraries C:\Users\Me\Downloads\AIRSDK_Compiler\frameworks\libs\air\21.0\airglobal.swc

Thanks for the tip @SushiHangover!