Xamarin Android Error inflating a custom widget from a java bound library

218 Views Asked by At

Currently I'm trying to get up and running Google VR's simple VrPanoramaView using Xamarin.

I've used this project (Xamarin Components) to manually bind the Java libraries. Binding the project, and more specifically, the PanoWidget, resulted in the following: PanoWidget image

I get the following code when I use the Object Browser to look into VrPanoramaView's C# code (partially included code):

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) {
            [...]
            [...]
            [...]
         }
    }
}

From what I can understand the VrPanoramaView has been registered and is supposedly accessible by referencing it in the following way in a layout:

<?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>

Nevertheless, when I build and deploy the application I get the following error:

Android.Views.InflateException: Binary XML file line #1: Binary XML file line #1: Error inflating class com.google.vr.sdk.widgets.pano.VrPanoramaView

More specifically, it seems like it can't find the class:

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]]
0

There are 0 best solutions below