目前我正在尝试VrPanoramaView
使用 Xamarin 启动并运行 Google VR 的简单功能。
我已经使用这个项目(Xamarin 组件)来手动绑定 Java 库。绑定项目,更具体地说,绑定PanoWidget,结果如下:PanoWidget 图像
当我使用对象浏览器查看VrPanoramaView
C# 代码(部分包含代码)时,我得到以下代码:
using System;
using System.Collections.Generic;
using Android.Runtime;
namespace Google.VR.SDK.Widgets.Pano {
// Metadata.xml XPath class reference: path="/api/package[@name='com.google.vr.sdk.widgets.pano']/class[@name='VrPanoramaView']"
[global::Android.Runtime.Register ("com/google/vr/sdk/widgets/pano/VrPanoramaView", DoNotGenerateAcw=true)]
public partial class VrPanoramaView : global::Google.VR.SDK.Widgets.Common.VrWidgetView {
[...]
[...]
[...]
// Metadata.xml XPath constructor reference: path="/api/package[@name='com.google.vr.sdk.widgets.pano']/class[@name='VrPanoramaView']/constructor[@name='VrPanoramaView' and count(parameter)=2 and parameter[1][@type='android.content.Context'] and parameter[2][@type='android.util.AttributeSet']]"
[Register (".ctor", "(Landroid/content/Context;Landroid/util/AttributeSet;)V", "")]
public unsafe VrPanoramaView (global::Android.Content.Context p0, global::Android.Util.IAttributeSet p1)
: base (IntPtr.Zero, JniHandleOwnership.DoNotTransfer) {
[...]
[...]
[...]
}
}
}
据我所知,VrPanoramaView
已经注册并且可以通过在布局中以下列方式引用它来访问:
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent">
<com.google.vr.sdk.widgets.pano.VrPanoramaView
android:id="@+id/pano_view"
android:layout_margin="5dip"
android:layout_width="match_parent"
android:scrollbars="@null"
android:layout_height="250dip" />
<Button
android:id="@+id/MyButton"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="@string/Hello" />
</RelativeLayout>
然而,当我构建和部署应用程序时,我收到以下错误:
Android.Views.InflateException: Binary XML file line #1: Binary XML file line #1: Error inflating class com.google.vr.sdk.widgets.pano.VrPanoramaView
更具体地说,它似乎找不到类:
Java.Lang.ClassNotFoundException: Didn't find class "com.google.vr.sdk.widgets.pano.VrPanoramaView" on path: DexPathList[[zip file "/data/app/App7.App7-1/base.apk"],nativeLibraryDirectories=[/data/app/App7.App7-1/lib/arm64, /data/app/App7.App7-1/base.apk!/lib/arm64-v8a, /vendor/lib64, /system/lib64]]