【问题标题】:ARToolkit native example project not workingARToolkit 本机示例项目不工作
【发布时间】:2016-04-05 05:42:34
【问题描述】:

最近我一直在做一个在 android studio 上使用 ARToolkit5 的项目。由于我对使用 NDK 进行开发完全不熟悉,所以起初我想查看包含在artoolkit 中的示例项目。基于 java 的示例运行良好(ARSimpleProj 和 ARSimpleInteractionProj)。但是,当我尝试使用本机库(ARSimpleNativeProj 和 ARSimpleNativeCarsProj)运行项目时,项目无法正常工作。

我得到的只是 logcat 中的一些错误消息,如下所示:

E/libARWrapper: ARController (native): [error]Loading single AR marker from >file 'Data/patt.hiro', width 80.000000. E/libARWrapper:ARController(本机):[错误]错误:无法从文件“Data/patt.hiro”加载单个 >AR 标记。 E/libARWrapper: ARController (native): [error]Error: Failed to load marker.

E/libARWrapper: ARController (native): [error]Loading single AR marker from >file 'Data/patt.kanji', width 80.000000. E/libar:打开模式文件“Data/patt.kanji”进行读取时出错。 E/libARWrapper:ARController(本机):[错误]错误:无法从文件“Data/patt.kanji”加载单个 >AR 标记。 E/libARWrapper: ARController (native): [error]Error: Failed to load marker.

并且在 logcat 中有一条连续的消息:

E/libARWrapper: ARController (native): [错误]arwQueryMarkerTransformation(): 找不到带有 UID 的标记 -1.

我已经尝试了很多来找出问题所在。我找不到解决方案。任何帮助表示赞赏。

我正在添加更多关于 logcat 输出的细节,希望它能提供一些额外的信息

E/libARWrapper: ARController (native): VideoSource::configure(): video >源视频配置:“-format=NV21” E/libARWrapper: ARController (native): VideoSource::configure(): video >Source camera parameters: "Data/camera_para.dat" E/libARWrapper: ARController (native): [error]Opening Android Video Source.

E/libARWrapper: ARController (native): ARController::startRunning(): 调用,>开始运行 E/libARWrapper: ARController (native): [error]ARController::startRunning(): >Error: 未初始化,退出,返回false E/ARToolKit:开始视频时出错 E/ARActivity:初始化相机时出错。无法继续。

我在 logcat 顶部遇到此消息。我无法确定导致此类错误的原因

E/Zygote: Zygote:  error closing descriptor
libcore.io.ErrnoException: close failed: EBADF (Bad file number)
at libcore.io.Posix.close(Native Method)
at libcore.io.BlockGuardOs.close(BlockGuardOs.java:75)
at                                         com.android.internal.os.ZygoteInit.closeServerSocket(ZygoteInit.java:221)
at com.android.internal.os.ZygoteConnection.handleChildProc(ZygoteConnection.java:879)
at com.android.internal.os.ZygoteConnection.runOnce(ZygoteConnection.java:242)
at com.android.internal.os.ZygoteInit.runSelectLoop(ZygoteInit.java:713)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:649)
at dalvik.system.NativeStart.main(Native Method)

【问题讨论】:

    标签: android android-studio android-ndk artoolkit


    【解决方案1】:

    使用 Android Studio 和 ARToolKit 时要做的第一件事是运行位于 ARTOOLKIT_ROOT/安卓 build.sh 和 build_native_examples.sh

    ARToolKit doku 也是一个很好的起点: http://www.artoolkit.org/documentation/doku.php?id=4_Android:android_native

    如果您使用的是 GitHub 版本,则即将发布的文档有更新。由于它未在 ARToolKit.org jet 上发布,因此我为您附上了 PDF:

    https://drive.google.com/file/d/0B0I5m7Yc2x-rZm5vcDBDOGo1Rm8/view?usp=sharing

    编辑:

    我刚刚验证过:

    • 操作系统 Ubuntu 14.04
    • Android Studio 1.5.1
    • 来自 GitHub 主分支的 ARToolKit
    • NDK 11 / Android SDK 6.0 / Java 1.7.0_79

    对我有用的步骤:

    • 执行ARTOOLKIT_ROOT/android/build.sh
    • 执行ARTOOLKIT_ROOT/android/build_native_examples.sh
    • 启动 AndroidStudio
    • 导入项目 -> ARNativeSimpleProj
    • 在 Nexus 5 上运行

    这一切都很好。

    【讨论】:

    • 我已按照文档中提到的每一个步骤进行操作。但我仍然无法让原生项目运行。仍然得到与上述相同的错误。非常感谢您的回复@Gizmo
    • 我再看看,你用的是哪个操作系统?
    • Ubuntu 15.04, Android Studio 1.5, Build #AI-141.2422023, JRE 1.7.0_80
    【解决方案2】:

    尝试完全删除您的应用程序或删除应用程序数据。该应用程序将从数据文件夹中缓存您的数据,因此如果您进行任何更改,它不会将其拾取。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2013-05-30
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多