如何在NDK-BUILD中构建arcore camera_utility共享库? [英] How do I build the arcore camera_utility shared library in NDK-BUILD?

查看:121
本文介绍了如何在NDK-BUILD中构建arcore camera_utility共享库?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试在NDK_BUILD中构建"arcore相机实用程序"库,网址为: https://github.com/google-ar/arcore-unity-sdk/tree/master/Assets/GoogleARCore/Examples/ComputerVision/Plugins/src

I'm trying to build the 'arcore camera utility' library in NDK_BUILD, here: https://github.com/google-ar/arcore-unity-sdk/tree/master/Assets/GoogleARCore/Examples/ComputerVision/Plugins/src

使用本指南: https://yeephycho.github.io/2016/10/20/How-to-Use-NDK-to-Build-A-Shared-Android_Native-Library/我至少是能够将其编译为libarcore_camera_utility.so文件.不仅如此,我的应用程序在电话上还可以识别它,而没有得到DLL丢失错误,我得到了一个错误:"EntryPointNotFoundException:无法在'arcore_camera_utility'中找到名为'TextureReader_create'的入口点."这意味着它至少现在已经找到了文件.

Using this guide: https://yeephycho.github.io/2016/10/20/How-to-Use-NDK-to-Build-A-Shared-Android_Native-Library/ I was at least able to get it to compile in a libarcore_camera_utility.so file. Not only that but it was actually recognized by my app on the phone and instead of getting a DLL missing error I got the error: "EntryPointNotFoundException: Unable to find an entry point named 'TextureReader_create' in 'arcore_camera_utility'." which means it at least found the file, now.

.so的文件大小只有6k,所以似乎我没有正确编译它,因为该软件包随附的已经工作的32bit版本是100k,基于这个问题,看来我遗漏了一些东西?:找不到入口点,Android .so文件

The filesize of the .so is only 6k so it seems like I'm not compiling it correctly as the already working 32bit version that comes with the package is 100k, based on this question it seems like I'm leaving something out?: Entry point not found, Android .so file

我的Android.mk文件为:

My Android.mk file is:

LOCAL_PATH := $(call my-dir)
include $(CLEAR_VARS)
LOCAL_MODULE := arcore_camera_utility_shared
LOCAL_C_INCLUDES += \
LOCAL_SRC_FILES := camera_utility.cc gl_utility.cc texture_reader.cc
include $(BUILD_STATIC_LIBRARY)

include $(CLEAR_VARS)
LOCAL_MODULE := arcore_camera_utility
LOCAL_WHOLE_STATIC_LIBRARIES := arcore_camera_utility_shared
include $(BUILD_SHARED_LIBRARY)

我的Application.mk文件包含:

And my Application.mk file contains:

APP_ABI := arm64-v8a
APP_PLATFORM := android-24
APP_STL := c++_static
APP_BUILD_SCRIPT := ./jni/Android.mk

我是否以不包含代码的方式构建它?

Am I building it in such a way as to leave the code out?

推荐答案

为arm 64位目标编译arcore_camera_utility-

To compile arcore_camera_utility for the arm 64bit target-

1.)创建一个名为"arcorelibrary"的新目录,然后创建一个名为"jni"的子目录

1.) Create a new directory called 'arcorelibrary', then a subdirectory called 'jni'

2.)下载此zip: https://github.com/google-ar/arcore-unity-sdk/blob/master/Assets/GoogleARCore/Examples/ComputerVision/Plugins/src/arcore_camera_utility.zip

2.) Download this zip: https://github.com/google-ar/arcore-unity-sdk/blob/master/Assets/GoogleARCore/Examples/ComputerVision/Plugins/src/arcore_camera_utility.zip

3.)获取三个.cc文件和三个.h文件,并将它们放置在jni目录中

3.) get the three .cc files and the three .h files and place them in the jni directory

4.)创建一个名为"Android.mk"的文件,并将其放置在jni目录中,其内容如下:

4.) Create a file called 'Android.mk' and place it in the jni directory, with the following contents:

LOCAL_PATH:= $(call my-dir)
include $(CLEAR_VARS)
LOCAL_MODULE:= arcore_camera_utility_static
LOCAL_SRC_FILES:= camera_utility.cc gl_utility.cc texture_reader.cc
LOCAL_EXPORT_C_INCLUDES := $(LOCAL_PATH)
LOCAL_EXPORT_LDLIBS    := -llog -landroid -lEGL -lGLESv2 -lGLESv3
include $(BUILD_STATIC_LIBRARY)

include $(CLEAR_VARS)
LOCAL_MODULE := arcore_camera_utility
LOCAL_WHOLE_STATIC_LIBRARIES := arcore_camera_utility_static
include $(BUILD_SHARED_LIBRARY)

5.)创建一个名为"Application.mk"的文件,并将其放置在jni目录中,其中包含以下内容:

5.) Create a file called 'Application.mk' and place it in the jni directory, with the following contents:

APP_ABI := arm64-v8a
APP_PLATFORM := android-24
APP_STL := c++_static
APP_BUILD_SCRIPT := ./jni/Android.mk

6.)下载Android NDK并解压缩到某个位置(所需的版本取决于您所使用的Unity版本) https://developer.android.com/ndk/downloads/older_releases.html

6.) Download Android NDK and unzip somewhere (The version you need depends on which Unity version you're using) https://developer.android.com/ndk/downloads/older_releases.html

7.)打开终端或powershell,转到项目的根目录(arcorelibrary)

7.) Open a terminal or powershell, go to the root directory (arcorelibrary) of your project

8.)创建到您解压缩Android NDK位置的路径(Powershell示例):

8.) Create a path to where ever you unzipped Android NDK (Powershell example):

$env:Path += ";C:\[where-ever-you-unzipped]\android-ndk-r13b-windows-x86_64\android-ndk-r13b"

9.)运行:

ndk-build.cmd

这篇关于如何在NDK-BUILD中构建arcore camera_utility共享库?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆