【问题标题】:Flex/ADL: Native methods are not allowed in loaded codeFlex/ADL:加载的代码中不允许使用本机方法
【发布时间】:2016-09-19 01:39:03
【问题描述】:

我正在尝试在 ADL 命令行调试器下运行我的 AIR 应用程序,包括 third party native extension(我没有使用诸如 FlashDevelop 之类的 IDE)。我的应用适用于 Windows 桌面计算机。

编译似乎没有问题:

$ amxmlc src/menustatemain.as
    -o src/menustatemain.swf
    -compiler.include-libraries C:\Users\Me\Downloads\AIRSDK_Compiler\frameworks\libs\player\21.0\playerglobal.swc
    -external-library-path+=extensions\ane\NativeJoystick.swc
    -use-network=false
    -verbose-stacktraces=true
    -debug=true
    -advanced-telemetry
    -omit-trace-statements=false
    -define=CONFIG::debug,false
    -define=CONFIG::test,true
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

但是,当我尝试在 ADL 下运行应用程序时,它会失败并出现以下错误:

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

我已经用谷歌搜索了,但我尝试过的都没有解决这个问题。 StackOverflow 上有几个类似的问题,它们的答案并不能解决我的问题。我已经更改了我能找到的所有设置,以便在编译时动态链接扩展并在运行时加载它。我有一种预感,这可能是扩展程序本身的问题,但我不知道如何验证。

如何调试这个问题?

对于上下文,这是menustatemain.xml的内容:

<application xmlns="http://ns.adobe.com/air/application/21.0">
    <id>com.me.MyProject</id>
    <versionNumber>1.0</versionNumber>
    <filename>MyProject</filename>
    <initialWindow>
        <content>MyProject.swf</content>
        <visible>true</visible>
        <width>640</width>
        <height>480</height>
        <maximizable>false</maximizable>
        <resizable>false</resizable>
    </initialWindow>
    <supportedProfiles>extendedDesktop</supportedProfiles>
    <extensions>
        <extensionID>com.iam2bam.ane.nativejoystick</extensionID>
    </extensions>
</application>

另外,我在项目子目录中有本地扩展的已编译和未编译版本:

C:\Users\Me\Documents\myproject
    extensions\
        ane\
            NativeJoystick.ane
            NativeJoystick.swc
        ane_unzipped\
            NativeJoystick.ane\
                META-INF\
                    ...

【问题讨论】:

  • 听起来adl 选择了错误的Playerglobal.swc 或错误的版本。
  • 我通过-compiler.include-libraries C:\Users\Me\Downloads\AIRSDK_Compiler\frameworks\libs\player\21.0\playerglobal.swc 指定它。您认为指定不同的版本会有所帮助吗?我怎么知道要使用哪个版本?
  • 我“假设”您正在编译的播放器是自 21.0 目录以来的正确播放器。我说的是adl。这是从 21.0 开始运行的吗?即设置 -runtime 选项是否可以修复您的 #1079 错误?通常,每当我看到该错误时,adl 来自错误的版本和/或它没有选择正确的播放器 swc,因此它会失败,因为它选择的播放器囊是闪光的,而不是基于空气的。 .. 另外,当您将应用程序打包到本机 air 安装程序中时会发生什么,它运行正常吗?

标签: flash apache-flex actionscript air


【解决方案1】:

问题是我使用了错误的playerglobal.swc。 Flex SDK 下载附带一个“播放器”框架和一个“AIR”框架,我错误地针对不允许本地扩展的“播放器”进行编译。改变我的编译命令就可以了:

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

感谢@SushiHangover 的提示!

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2021-12-20
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2020-06-17
    • 2013-06-09
    • 2018-09-08
    相关资源
    最近更新 更多