-
moado计划表
image.png
- 首先介绍openxr官方网站OpenXR Overview - The Khronos Group Inc
这里有openxr runtime ,由于我们用的是android平台,所以我们选择了Monado - XR Runtime (XRT)
image.png
image.png - 这里我们找到了它的开源代码 Monado / Monado · GitLab
首先把它下载下来
git clone https://gitlab.freedesktop.org/monado/monado.git
-
然后用androidstudio打开
出现的第一个报错
49928011024090348.jpg
原因是找不到python3 ,首先确保我们安装了python 3.x版本,然后把名字改下
image.png
出现的第二个报错是eigen 找不到 ,所以我们去官方下载了eigen-3.4.0.zip然后把路径配置到项目下面
eigenIncludeDir=D:\Tools\eigen-3.4.0\eigen-3.4.0
-
编译运行,编译出来是一个apk自动安装的,继续看看运行时怎么用的
image.png
编译生成的文件确实有这个
image.png
打开查看里面是so路径
image.png
-
接下来用androidstudio去打开openxr 的例子hello_xr
image.png
编译运行会出现如下报错,问题可能是runtime没配置好
E/openxr_loader: Could access neither the installable nor system runtime broker.
E/OpenXR-Loader: Error [GENERAL | | OpenXR-Loader] : RuntimeManifestFile::FindManifestFiles - failed to determine active runtime file path for this environment
image.png
-编译 安装openxr-android-broker
Monado / Utilities / openxr-android-broker · GitLab
这里有个权限要求暂时不知道咋解决,先删掉验证
image.png
-
再次打开hello xr
image.png
编译一个opengl的试试
image.png
这俩问题就很简单了,至少openxr的例子跑起来了
- 最后找了台pixel4 xl 就没有上面的异常,看来huawei mate30 还不支持那个api
I/openxr_loader: getActiveRuntimeCursor: Querying URI: content://org.khronos.openxr.runtime_broker/openxr/1/abi/arm64-v8a/runtimes/active/0
V/threaded_app: Start: 0x7edf91bbc0
I/OpenXR-Loader: Got runtime: package: org.freedesktop.monado.openxr_runtime.in_process, so filename: /data/app/org.freedesktop.monado.openxr_runtime.in_process-lhEeNT0DMOpyyth7Ri37ow==/lib/arm64, native lib dir: libopenxr_monado.so, has functions: no
I/OpenXR-Loader: Info [GENERAL | xrEnumerateInstanceExtensionProperties | OpenXR-Loader] : RuntimeInterface::LoadRuntime forwarding xrInitializeLoaderKHR call to runtime after calling xrNegotiateLoaderRuntimeInterface.
Info [GENERAL | xrEnumerateInstanceExtensionProperties | OpenXR-Loader] : RuntimeInterface::LoadRuntime succeeded loading runtime defined in manifest file using interface version 1 and OpenXR API version 1.0
V/OpenXR-Loader: Verbose [GENERAL | xrEnumerateInstanceExtensionProperties | OpenXR-Loader] : Completed loader trampoline
Verbose [GENERAL | xrEnumerateInstanceExtensionProperties | OpenXR-Loader] : Entering loader trampoline
Verbose [GENERAL | xrEnumerateInstanceExtensionProperties | OpenXR-Loader] : Completed loader trampoline
Verbose [GENERAL | xrEnumerateApiLayerProperties | OpenXR-Loader] : Entering loader trampoline
Verbose [GENERAL | xrEnumerateApiLayerProperties | OpenXR-Loader] : Entering loader trampoline
V/hello_xr: [09:37:07.678][Info ] Available Layers: (0)
V/OpenXR-Loader: Verbose [GENERAL | xrCreateInstance | OpenXR-Loader] : Entering loader trampoline
Verbose [GENERAL | xrCreateInstance | OpenXR-Loader] : Entering LoaderInstance::CreateInstance
Verbose [GENERAL | xrCreateInstance | OpenXR-Loader] : Entering loader terminator
V/threaded_app: activityState=10
V/hello_xr: [09:37:07.678][Info ] APP_CMD_START
V/hello_xr: [09:37:07.678][Info ] onStart()
V/threaded_app: Resume: 0x7edf91bbc0
V/threaded_app: activityState=11
V/hello_xr: [09:37:07.680][Info ] onResume()
[09:37:07.680][Info ] APP_CMD_RESUME
-
下面看加载过程
image.png
- provide 例子,下载后用于选择runtime
Utilities · GitLab
image.png
- 升级androidstudio版本到2021.1.1版本后出现的问题
编译啥的都能通过,但是打开c代码,无法跳转。刚开始怀疑monon修改导致,退回他们修改还是一样
image.png
各种方法都尝试后还是不行,退回2020版本的androidstudio才正常,下载老版本studio的路径https://developer.android.google.cn/studio/archive
- 解决2021.1.1版本代码跳转问题,经过排查是因为gradle版本过低跟studio版本不匹配导致的
下面提供下升级方法:这样就可以愉快的使用最新版本的studio了
ndex db6d05fb..316ce244 100644
--- a/build.gradle
+++ b/build.gradle
@@ -14,7 +14,7 @@ buildscript {
androidxLifecycleVersion = "2.2.0"
androidxConstraintLayoutVersion = '2.0.4'
- hiltVersion = '2.35.1'
+ hiltVersion = '2.40.1'
materialVersion = "1.3.0"
}
@@ -23,7 +23,7 @@ buildscript {
mavenCentral()
}
dependencies {
- classpath 'com.android.tools.build:gradle:4.2.1'
+ classpath 'com.android.tools.build:gradle:7.2.0'
//noinspection DifferentKotlinGradleVersion
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlinVersion"
classpath "com.mikepenz.aboutlibraries.plugin:aboutlibraries-plugin:${latestAboutLibsRelease}"
diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties
index 442d9132..2e6e5897 100644
--- a/gradle/wrapper/gradle-wrapper.properties
+++ b/gradle/wrapper/gradle-wrapper.properties
@@ -1,5 +1,5 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
-distributionUrl=https\://services.gradle.org/distributions/gradle-6.8.3-bin.zip
+distributionUrl=https\://services.gradle.org/distributions/gradle-7.3.3-bin.zip
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
网友评论