B4A Library Google VR

warwound

Expert
Licensed User
This library wraps the 'pano' and 'video' packages from the Google VR for Android API.
Enabling you to display mono and stereo 360° VR images and videos in your projects.

Look at the VrPanoramaView and VrVideoView objects, these are the View objects you'll use in your project.
Each View has a similarly named Options object that along with the VrWidgetViewDisplayMode object contain constants and configurations values required by various library methods.

GoogleVr
Version:
1.20
  • VrConstants
    Fields:
    • VrPanoramaViewOptions As VrPanoramaViewOptions
    • VrVideoViewOptions As VrVideoViewOptions
    • VrWidgetViewDisplayMode As VrWidgetViewDisplayMode
  • VrPanoramaView
    Events:
    • Click
    • DisplayModeChanged (NewDisplayMode As Int)
    • LoadError (ErrorMessage As String)
    • LoadSuccess
    Fields:
    • GRAVITY_BOTTOM As Int
    • GRAVITY_CENTER As Int
    • GRAVITY_CENTER_HORIZONTAL As Int
    • GRAVITY_CENTER_VERTICAL As Int
    • GRAVITY_FILL As Int
    • GRAVITY_FILL_HORIZONTAL As Int
    • GRAVITY_FILL_VERTICAL As Int
    • GRAVITY_LEFT As Int
    • GRAVITY_NO_GRAVITY As Int
    • GRAVITY_RIGHT As Int
    • GRAVITY_TOP As Int
    • ba As BA
    Methods:
    • AddView (View As View, Width As Int, Height As Int, Gravity As Int)
    • BringToFront
    • GetAllViewsRecursive As IterableList
    • GetHeadRotation (YawAndPitch() As Float)
      Provides yaw and pitch angles corresponding to where the user is looking.

      yaw is the rotation along the vertical (y) axis.
      Values are in the [-180, 180] range where:
      • 0 - looking straight at the initial image orientation.
      • 90 - looking 90 degrees to the right.
      • -90 - looking 90 degrees to the left.
      • -180 or 180 - looking in the direction opposite to the initial one

      pitch is the rotation along the right (x) axis previously rotated by yaw.
      Values are in the [-90, 90] range where:
      • 0 - looking straight, level with the ground.
      • 90 - looking up
      • -90 - looking down

      When pitch approaches 90 or -90, yaw values are reset to zero as computing the yaw values becomes numerically unstable.
    • GetView (Index As Int) As ConcreteViewWrapper
    • Initialize
      Initialize the VrWidgetView.
    • Initialize2 (EventName As String)
      Initialize the VrWidgetView and set an event listener.
      (Shortcut for calling Initialize then SetEventListener methods).
    • Invalidate
    • Invalidate2 (arg0 As Rect)
    • Invalidate3 (arg0 As Int, arg1 As Int, arg2 As Int, arg3 As Int)
    • IsInitialized As Boolean
    • LoadImageFromBitmap (Bitmap1 As Bitmap, InputType As Int)
      Asynchronously loads a pano image using the given bitmap.
      The image to load should be encoded in ARGB_8888 or RGB_565 format.
      See format description at android.graphics.Bitmap.Config
      Event LoadError or LoadSuccess will be raised.
    • PauseRendering
      Pauses 3D rendering and tracking.
      This should be called in the activity's onPause() method.
    • RemoveAllViews
    • RemoveView
    • RemoveViewAt (Index As Int)
    • RequestFocus As Boolean
    • ResumeRendering
      Resumes 3D rendering and tracking.
      This should be called in the activity's onResume() method.
    • SendToBack
    • SetBackgroundImage (arg0 As Bitmap)
    • SetColorAnimated (arg0 As Int, arg1 As Int, arg2 As Int)
    • SetElevationAnimated (Duration As Int, Elevation As Float)
    • SetEventListener (EventName As String)
      Set an event listener.
      Events raised:
      Click - Called when the view has been clicked.
      DisplayModeChanged - Called when the view's display mode has changed.
      LoadError - There was an error when loading the resource.
      LoadSuccess - The resource was successfully loaded and rendering has started.
      Pass Null to clear an existing event listener.
    • SetLayout (arg0 As Int, arg1 As Int, arg2 As Int, arg3 As Int)
    • SetLayoutAnimated (arg0 As Int, arg1 As Int, arg2 As Int, arg3 As Int, arg4 As Int)
    • SetVisibleAnimated (arg0 As Int, arg1 As Boolean)
    • Shutdown
      Shuts rendering down and releases associated memory.
      Make sure you call this method before the activity is destroyed to reclaim memory. This can be typically called in the activity's onDestroy() method.
      PauseRendering() must be called prior to this function.
      The View should not be used anymore after this method has been called.
    Properties:
    • Background As Drawable
    • Color As Int [write only]
    • Constants As VrConstants [read only]
      Returns the VrConstants object.
    • DisplayMode As Int
      Get or Set the widget's DisplayMode.
      Use the VrWidgetViewDisplayMode constants to set this value.
    • Elevation As Float
    • Enabled As Boolean
    • FullscreenButtonEnabled As Boolean [write only]
      Shows or hides the button to transition to fullscreen mode.
      This button is visible by default whenever the View is in embedded or in stereo mode.
    • Height As Int
    • InfoButtonEnabled As Boolean [write only]
      Shows or hides the show info button.
      The button is visible by default.
    • Left As Int
    • NumberOfViews As Int [read only]
    • Padding()() As Int
    • Parent As Object [read only]
    • StereoModeButtonEnabled As Boolean [write only]
      Shows or hides the button to transition to stereo mode.
      This button is visible by default whenever the View is in embedded or fullscreen mode.
      This button will never be shown on phones which don't have the necessary sensors for stereo mode -- i.e. a gyroscope and accelerometer.
    • Tag As Object
    • Top As Int
    • TouchTrackingEnabled As Boolean [write only]
      Enables or disabled tracking of the view via touch gestures. Only the heading angle can be controlled by touch. This is true by default.
      Regardless of how this is set, touch tracking will be inactive in fullscreen stereo mode.
    • Visible As Boolean
    • Width As Int
  • VrPanoramaViewOptions
    Fields:
    • TYPE_MONO As Int
    • TYPE_STEREO_OVER_UNDER As Int
  • VrVideoView
    Events:
    • Click
    • Completion
    • DisplayModeChanged (NewDisplayMode As Int)
    • LoadError (ErrorMessage As String)
    • LoadSuccess
    • NewFrame
    Fields:
    • GRAVITY_BOTTOM As Int
    • GRAVITY_CENTER As Int
    • GRAVITY_CENTER_HORIZONTAL As Int
    • GRAVITY_CENTER_VERTICAL As Int
    • GRAVITY_FILL As Int
    • GRAVITY_FILL_HORIZONTAL As Int
    • GRAVITY_FILL_VERTICAL As Int
    • GRAVITY_LEFT As Int
    • GRAVITY_NO_GRAVITY As Int
    • GRAVITY_RIGHT As Int
    • GRAVITY_TOP As Int
    • ba As BA
    Methods:
    • AddView (View As View, Width As Int, Height As Int, Gravity As Int)
    • BringToFront
    • GetAllViewsRecursive As IterableList
    • GetHeadRotation (YawAndPitch() As Float)
      Provides yaw and pitch angles corresponding to where the user is looking.

      yaw is the rotation along the vertical (y) axis.
      Values are in the [-180, 180] range where:
      • 0 - looking straight at the initial image orientation.
      • 90 - looking 90 degrees to the right.
      • -90 - looking 90 degrees to the left.
      • -180 or 180 - looking in the direction opposite to the initial one

      pitch is the rotation along the right (x) axis previously rotated by yaw.
      Values are in the [-90, 90] range where:
      • 0 - looking straight, level with the ground.
      • 90 - looking up
      • -90 - looking down

      When pitch approaches 90 or -90, yaw values are reset to zero as computing the yaw values becomes numerically unstable.
    • GetView (Index As Int) As ConcreteViewWrapper
    • Initialize
      Initialize the VrWidgetView.
    • Initialize2 (EventName As String)
      Initialize the VrWidgetView and set an event listener.
      (Shortcut for calling Initialize then SetEventListener methods).
    • Invalidate
    • Invalidate2 (arg0 As Rect)
    • Invalidate3 (arg0 As Int, arg1 As Int, arg2 As Int, arg3 As Int)
    • IsInitialized As Boolean
    • LoadVideo (Path As String, VideoFormat As Int, VideoType As Int)
      Asynchronously loads a pano video from the given Path.
      The Path can be a path to a local file or a remote URL with an <i>http</i> or <i>https</i> scheme.
      VideoFormat and VideoType are constants from the VrVideoViewOptions object.
      Event LoadError or LoadSuccess will be raised.
    • LoadVideoFromAsset (Path As String, VideoFormat As Int, VideoType As Int)
      Asynchronously loads a pano video from the given file in the assets of the apk.
      If the video isn't located the assets, the general LoadVideo(Path As String, VideoFormat As Int, VideoType As Int) method should be used.
      VideoFormat and VideoType are constants from the VrVideoViewOptions object.
      Event LoadError or LoadSuccess will be raised.
    • PauseRendering
      Pauses 3D rendering and tracking.
      This should be called in the activity's onPause() method.
      This also pauses the video and resumeRendering() will resume rendering tracking but not the video playback.
      If the app wants to resume playing the video it should call PlayVideo() when appropriate.
    • PauseVideo
      Pauses the video if it is playing.
    • PlayVideo
      Starts playing the video as soon as it is loaded.
      Resumes playing a paused video.
    • RemoveAllViews
    • RemoveView
    • RemoveViewAt (Index As Int)
    • RequestFocus As Boolean
    • ResumeRendering
      Resumes 3D rendering and tracking.
      This should be called in the activity's onResume() method.
    • SeekTo (PositionMillis As Long)
      Seeks to a position in the video.
    • SendToBack
    • SetBackgroundImage (arg0 As Bitmap)
    • SetColorAnimated (arg0 As Int, arg1 As Int, arg2 As Int)
    • SetElevationAnimated (Duration As Int, Elevation As Float)
    • SetEventListener (EventName As String)
      Set an event listener.
      Events raised:
      Click - Called when the view has been clicked.
      Completion - The video has finished playing.
      DisplayModeChanged - Called when the view's display mode has changed.
      LoadError - There was an error when loading the resource.
      LoadSuccess - The resource was successfully loaded and rendering has started.
      NewFrame - A new frame has been drawn to the screen.
      Pass Null to clear an existing event listener.
    • SetLayout (arg0 As Int, arg1 As Int, arg2 As Int, arg3 As Int)
    • SetLayoutAnimated (arg0 As Int, arg1 As Int, arg2 As Int, arg3 As Int, arg4 As Int)
    • SetVisibleAnimated (arg0 As Int, arg1 As Boolean)
    • SetVolume (Volume As Float)
      Sets a multiplier to the volume between 0.0f and 1.0f on the media audio playback.
      This setting persists across multiple videos. Set to 1.0f by default.
      TODO do not use - method not found!
    • Shutdown
      Shuts rendering down and releases associated memory.
      Make sure you call this method before the activity is destroyed to reclaim memory. This can be typically called in the activity's onDestroy() method.
      PauseRendering() must be called prior to this function.
      The View should not be used anymore after this method has been called.
    Permissions:
    • android.permission.INTERNET
    • android.permission.READ_EXTERNAL_STORAGE
    Properties:
    • Background As Drawable
    • Color As Int [write only]
    • Constants As VrConstants [read only]
      Returns the VrConstants object.
    • CurrentPosition As Long [read only]
      Gets the current position in the video.
      Returns the current position in milliseconds.
    • DisplayMode As Int
      Get or Set the widget's DisplayMode.
      Use the VrWidgetViewDisplayMode constants to set this value.
    • Duration As Long [read only]
      Gets the duration of the video.
      Returns the duration in milliseconds.
    • Elevation As Float
    • Enabled As Boolean
    • FullscreenButtonEnabled As Boolean [write only]
      Shows or hides the button to transition to fullscreen mode.
      This button is visible by default whenever the View is in embedded or in stereo mode.
    • Height As Int
    • InfoButtonEnabled As Boolean [write only]
      Shows or hides the show info button.
      The button is visible by default.
    • Left As Int
    • NumberOfViews As Int [read only]
    • Padding()() As Int
    • Parent As Object [read only]
    • StereoModeButtonEnabled As Boolean [write only]
      Shows or hides the button to transition to stereo mode.
      This button is visible by default whenever the View is in embedded or fullscreen mode.
      This button will never be shown on phones which don't have the necessary sensors for stereo mode -- i.e. a gyroscope and accelerometer.
    • Tag As Object
    • Top As Int
    • TouchTrackingEnabled As Boolean [write only]
      Enables or disabled tracking of the view via touch gestures. Only the heading angle can be controlled by touch. This is true by default.
      Regardless of how this is set, touch tracking will be inactive in fullscreen stereo mode.
    • Visible As Boolean
    • Width As Int
  • VrVideoViewOptions
    Fields:
    • FORMAT_DEFAULT As Int
    • FORMAT_HLS As Int
    • TYPE_MONO As Int
    • TYPE_STEREO_OVER_UNDER As Int
  • VrWidgetViewDisplayMode
    Fields:
    • EMBEDDED As Int
    • FULLSCREEN_MONO As Int
    • FULLSCREEN_STEREO As Int

A minimum android API level of 21 is required in order to use this library.
The library also depends on 4 .aar format libraries from Google:
  • common.aar
  • commonwidget.aar
  • panowidget.aar
  • videowidget.aar
These are included in the Google VR library and (java) demo available at:
https://developers.google.com/vr/android/download.
Look in the libraries folder in the download for the .aar files and then copy them across to your b4a additional libraries folder.

There have been problem with users not downloading the current latest version of the Google VR .aar files (more info HERE).
So the 4 .aar files you require can be downloaded from Google_VR_aar_libs_20170130.zip.
These .aar files are currently version 1.10.0
I'll post a simple example next...

Library files are over 1MB in size so cannot be attached to this post. Instead download them from HERE.
 
Last edited:

warwound

Expert
Licensed User
Simple VrPanoramaView example.

We have a stereo panoramic image in the project's files folder and we use the VrPanoramaView LoadImageFromBitmap method to load the image:

B4X:
#Region  Project Attributes
    #ApplicationLabel: Vr PanoramaView
    #VersionCode: 1
    #VersionName:
    'SupportedOrientations possible values: unspecified, landscape or portrait.
    #SupportedOrientations: unspecified
    #CanInstallToExternalStorage: True
    #AdditionalJar: common.aar
    #AdditionalJar: commonwidget.aar
    #AdditionalJar: videowidget.aar
#End Region

#Region  Activity Attributes
    #FullScreen: True
    #IncludeTitle: False
#End Region

Sub Process_Globals

End Sub

Sub Globals
    Private VrPanoramaView1 As VrPanoramaView
End Sub

Sub Activity_Create(FirstTime As Boolean)
   
    '    GoogleVr constants can be found in the VrPanoramaView.Constants object
   
    '    initialize and configure the VrPanoramaView
    VrPanoramaView1.Initialize2("VrPanoramaView1")
    VrPanoramaView1.DisplayMode=VrPanoramaView1.Constants.VrWidgetViewDisplayMode.EMBEDDED
    VrPanoramaView1.FullscreenButtonEnabled=True
    VrPanoramaView1.StereoModeButtonEnabled=True
    VrPanoramaView1.TouchTrackingEnabled=True
   
    '    the VrPanoramaView LoadImageFromBitmap method requires a Bitmap object
    Dim Bitmap1 As Bitmap
    Bitmap1.Initialize(File.DirAssets, "andes.jpg")
    VrPanoramaView1.LoadImageFromBitmap(Bitmap1, VrPanoramaView1.Constants.VrPanoramaViewOptions.TYPE_STEREO_OVER_UNDER)
   
    '    add the VrPanoramaView to the Activity
    Activity.AddView(VrPanoramaView1, 0, 0, 100%x, 100%y)
End Sub

Sub Activity_Resume
    '    start rendering when the Activity resumes
    VrPanoramaView1.ResumeRendering
End Sub

Sub Activity_Pause (UserClosed As Boolean)
    '    pause rendering when the Activity pauses
    VrPanoramaView1.PauseRendering
End Sub

'    VrPanoramaView raises 4 different events:
Sub VrPanoramaView1_Click
    Log("VrPanoramaView1_Click")
End Sub

Sub VrPanoramaView1_DisplayModeChanged(NewDisplayMode As Int)
    Log("VrPanoramaView1_DisplayModeChanged")
    Select NewDisplayMode
        Case VrPanoramaView1.Constants.VrWidgetViewDisplayMode.EMBEDDED
            Log("EMBEDDED")
        Case VrPanoramaView1.Constants.VrWidgetViewDisplayMode.FULLSCREEN_MONO
            Log("FULLSCREEN_MONO")
        Case VrPanoramaView1.Constants.VrWidgetViewDisplayMode.FULLSCREEN_STEREO
            Log("FULLSCREEN_STEREO")
    End Select
End Sub

Sub VrPanoramaView1_LoadError(ErrorMessage As String)
    Log("VrPanoramaView1_LoadError: "&ErrorMessage)
End Sub

Sub VrPanoramaView1_LoadSuccess
    Log("VrPanoramaView1_LoadSuccess")
End Sub

'    the official google vr library documentation recommends to call the Shutdown() method before the activity is destroyed
'    we'll use inline java to ensure that the Shutdown() method is called

#If JAVA

//    dispose of VrPanoramaView1 when Activity is destroyed
public void _onDestroy() {
    _vrpanoramaview1.Shutdown();
    super.onDestroy();
}

#End IF
Example project is over 1MB in size so cannot be attached to this post.
Instead download the example project from HERE.
 
Last edited:

MarcoRome

Expert
Licensed User
I tried about another PC, now i have this error in compilation:

B4X:
java.lang.NoClassDefFoundError: com.google.vrtoolkit.cardboard.proto.nano.CardboardDevice$DeviceParams
LogCat connected to: ce0616068410b73802
--------- beginning of main
** Service (starter) Create **
** Service (starter) Start **
** Service (sms_intercetta) Create **
** Service (sms_intercetta) Start **
--------- beginning of system
** Service (starter) Create **
** Service (starter) Start **
** Activity (main) Create, isFirst = true **
** Activity (main) Resume **
main_activity_resume (java line: 367)
java.lang.NoClassDefFoundError: com.google.vrtoolkit.cardboard.proto.nano.CardboardDevice$DeviceParams
at com.google.vr.cardboard.ConfigUtils.readDeviceParamsFromExternalStorage(SourceFile:73)
at com.google.vr.cardboard.LegacyVrParamsProvider.readDeviceParams(SourceFile:20)
at com.google.vr.sdk.widgets.common.VrWidgetView.updateViewerName(VrWidgetView.java:741)
at com.google.vr.sdk.widgets.common.VrWidgetView.updateStereoMode(VrWidgetView.java:497)
at com.google.vr.sdk.widgets.common.VrWidgetView.resumeRendering(VrWidgetView.java:600)
at imagineear.api.googlevr.widgets.VrWidgetViewWrapper.ResumeRendering(VrWidgetViewWrapper.java:76)
at imagineear.api.panoramaviewtest.main._activity_resume(main.java:367)
at java.lang.reflect.Method.invoke(Native Method)
at anywheresoftware.b4a.BA.raiseEvent2(BA.java:169)
at anywheresoftware.b4a.BA.raiseEvent(BA.java:153)
at imagineear.api.panoramaviewtest.main.afterFirstLayout(main.java:108)
at imagineear.api.panoramaviewtest.main.access$000(main.java:17)
at imagineear.api.panoramaviewtest.main$WaitForLayout.run(main.java:80)
at android.os.Handler.handleCallback(Handler.java:739)
at android.os.Handler.dispatchMessage(Handler.java:95)
at android.os.Looper.loop(Looper.java:158)
at android.app.ActivityThread.main(ActivityThread.java:7229)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1230)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1120)
 
Last edited:

Johan Schoeman

Expert
Licensed User
It seems as if the link to the B4A sample project is broken. Would really like to test this!

".......Instead download the example project from HERE......."


B4X:
The webpage cannot be found
  HTTP 404
  
Most likely causes:
•There might be a typing error in the address.
•If you clicked on a link, it may be out of date.
  
What you can try:
  

  Retype the address.
  

  Go back to the previous page.
  

  Go to  and look for the information you want.
  

More information  More information
 

MarcoRome

Expert
Licensed User
It seems as if the link to the B4A sample project is broken. Would really like to test this!

B4X:
The webpage cannot be found
  HTTP 404
  
Most likely causes:
•There might be a typing error in the address.
•If you clicked on a link, it may be out of date.
  
What you can try:
  

  Retype the address.
  

  Go back to the previous page.
  

  Go to  and look for the information you want.
  

More information  More information
HERE
@warwound forget : into link
 

Johan Schoeman

Expert
Licensed User
HERE
@warwound forget : into link
Did you manage to get it to compile and run? I get

B4X:
** Service (starter) Create **
** Service (starter) Start **
** Activity (main) Create, isFirst = true **
** Activity (main) Resume **
main_activity_resume (java line: 367)
java.lang.NoClassDefFoundError: com.google.vrtoolkit.cardboard.proto.nano.CardboardDevice$DeviceParams
    at com.google.vr.cardboard.ConfigUtils.readDeviceParamsFromExternalStorage(SourceFile:73)
    at com.google.vr.cardboard.LegacyVrParamsProvider.readDeviceParams(SourceFile:20)
    at com.google.vr.sdk.widgets.common.VrWidgetView.updateViewerName(VrWidgetView.java:741)
    at com.google.vr.sdk.widgets.common.VrWidgetView.updateStereoMode(VrWidgetView.java:497)
    at com.google.vr.sdk.widgets.common.VrWidgetView.resumeRendering(VrWidgetView.java:600)
    at imagineear.api.googlevr.widgets.VrWidgetViewWrapper.ResumeRendering(VrWidgetViewWrapper.java:76)
    at imagineear.api.panoramaviewtest.main._activity_resume(main.java:367)
    at java.lang.reflect.Method.invoke(Native Method)
    at java.lang.reflect.Method.invoke(Method.java:372)
    at anywheresoftware.b4a.BA.raiseEvent2(BA.java:169)
    at anywheresoftware.b4a.BA.raiseEvent(BA.java:153)
    at imagineear.api.panoramaviewtest.main.afterFirstLayout(main.java:108)
    at imagineear.api.panoramaviewtest.main.access$000(main.java:17)
    at imagineear.api.panoramaviewtest.main$WaitForLayout.run(main.java:80)
    at android.os.Handler.handleCallback(Handler.java:815)
    at android.os.Handler.dispatchMessage(Handler.java:104)
    at android.os.Looper.loop(Looper.java:194)
    at android.app.ActivityThread.main(ActivityThread.java:5643)
    at java.lang.reflect.Method.invoke(Native Method)
    at java.lang.reflect.Method.invoke(Method.java:372)
    at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:960)
    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:755)
 

MarcoRome

Expert
Licensed User
Did you manage to get it to compile and run? I get

B4X:
** Service (starter) Create **
** Service (starter) Start **
** Activity (main) Create, isFirst = true **
** Activity (main) Resume **
main_activity_resume (java line: 367)
java.lang.NoClassDefFoundError: com.google.vrtoolkit.cardboard.proto.nano.CardboardDevice$DeviceParams
    at com.google.vr.cardboard.ConfigUtils.readDeviceParamsFromExternalStorage(SourceFile:73)
    at com.google.vr.cardboard.LegacyVrParamsProvider.readDeviceParams(SourceFile:20)
    at com.google.vr.sdk.widgets.common.VrWidgetView.updateViewerName(VrWidgetView.java:741)
    at com.google.vr.sdk.widgets.common.VrWidgetView.updateStereoMode(VrWidgetView.java:497)
    at com.google.vr.sdk.widgets.common.VrWidgetView.resumeRendering(VrWidgetView.java:600)
    at imagineear.api.googlevr.widgets.VrWidgetViewWrapper.ResumeRendering(VrWidgetViewWrapper.java:76)
    at imagineear.api.panoramaviewtest.main._activity_resume(main.java:367)
    at java.lang.reflect.Method.invoke(Native Method)
    at java.lang.reflect.Method.invoke(Method.java:372)
    at anywheresoftware.b4a.BA.raiseEvent2(BA.java:169)
    at anywheresoftware.b4a.BA.raiseEvent(BA.java:153)
    at imagineear.api.panoramaviewtest.main.afterFirstLayout(main.java:108)
    at imagineear.api.panoramaviewtest.main.access$000(main.java:17)
    at imagineear.api.panoramaviewtest.main$WaitForLayout.run(main.java:80)
    at android.os.Handler.handleCallback(Handler.java:815)
    at android.os.Handler.dispatchMessage(Handler.java:104)
    at android.os.Looper.loop(Looper.java:194)
    at android.app.ActivityThread.main(ActivityThread.java:5643)
    at java.lang.reflect.Method.invoke(Native Method)
    at java.lang.reflect.Method.invoke(Method.java:372)
    at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:960)
    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:755)

Same my error in #5.
Seem that is necessary:

The Cardboard SDK includes a libprotobuf jar file. Make sure it is present and being included in your build.
as in this POST but i dont found
 

Johan Schoeman

Expert
Licensed User
Same my error in #5.
Seem that is necessary:



as in this POST but i dont found
Found the same posting on StackOverflow - so where do we find this jar? Will see if I can find it....
 

Johan Schoeman

Expert
Licensed User

Johan Schoeman

Expert
Licensed User
Yes same thing.
Wait the answer @warwound ( maybe we are lost a piece :) )
The required class is inside commor.aar - not sure why the error occurs? Is there perhaps a duplication taking place?

upload_2017-1-27_20-21-16.png
 

Johan Schoeman

Expert
Licensed User
Definition of class DeviceParams inside class CardboardDevice - it is there but for some reason it does not see it when the B4A project compiles (from common.aar)

B4X:
package com.google.vrtoolkit.cardboard.proto.nano;

import com.google.protobuf.nano.CodedInputByteBufferNano;
import com.google.protobuf.nano.CodedOutputByteBufferNano;
import com.google.protobuf.nano.ExtendableMessageNano;
import com.google.protobuf.nano.InternalNano;
import com.google.protobuf.nano.InvalidProtocolBufferNanoException;
import com.google.protobuf.nano.MessageNano;
import com.google.protobuf.nano.WireFormatNano;
import java.io.IOException;

public abstract interface CardboardDevice
{
  public static final class DeviceParams
    extends ExtendableMessageNano<DeviceParams>
    implements Cloneable
  {
    private static volatile DeviceParams[] _emptyArray;
    private int bitField0_;
    private String vendor_;
    private String model_;
    private float screenToLensDistance_;
    private float interLensDistance_;
    public float[] leftEyeFieldOfViewAngles;
    private int verticalAlignment_;
    private float trayToLensDistance_;
    public float[] distortionCoefficients;
    private boolean hasMagnet_;
    private int primaryButton_;
    public CardboardDevice.CardboardInternalParams internal;
    public CardboardDevice.DaydreamInternalParams daydreamInternal;
 

hanyelmehy

Active Member
Licensed User
Get Same error
java.lang.NoClassDefFoundError: com.google.vrtoolkit.cardboard.proto.nano.CardboardDevice$DeviceParams
 

warwound

Expert
Licensed User
Morning all.
I've fixed the link to the example - though you've figured that out.
What on earth has gone wrong - are you all using the latest version of b4a?
Just wondering if any of you are using an older version and the AdditionalRes attributes for the .aar files are not supported?
 
Top