googlevr / gvr-android-sdk

Google VR SDK for Android
http://developers.google.com/vr/android/
Other
3.28k stars 1.28k forks source link

No implementation found for GvrAudioEngine.nativeEnableStereoSpeakerMode(long, boolean) #625

Open sarathsi opened 5 years ago

sarathsi commented 5 years ago

gvrsdk: com.google.vr:sdk-audio:1.190.0

2019-03-21 15:48:28.154 16582-16582/? E/sceneviewsampl: No implementation found for void com.google.vr.sdk.audio.GvrAudioEngine.nativeEnableStereoSpeakerMode(long, boolean) (tried Java_com_google_vr_sdk_audio_GvrAudioEngine_nativeEnableStereoSpeakerMode and Java_com_google_vr_sdk_audio_GvrAudioEngine_nativeEnableStereoSpeakerModeJZ) 2019-03-21 15:48:28.155 16582-16582/? E/AndroidRuntime: FATAL EXCEPTION: main Process: com.huawei.hbs.arsceneviewsample, PID: 16582 java.lang.UnsatisfiedLinkError: No implementation found for void com.google.vr.sdk.audio.GvrAudioEngine.nativeEnableStereoSpeakerMode(long, boolean) (tried Java_com_google_vr_sdk_audio_GvrAudioEngine_nativeEnableStereoSpeakerMode and Java_com_google_vr_sdk_audio_GvrAudioEngine_nativeEnableStereoSpeakerModeJZ) at com.google.vr.sdk.audio.GvrAudioEngine.nativeEnableStereoSpeakerMode(Native Method) at com.google.vr.sdk.audio.GvrAudioEngine.enableSpeakerStereoMode(SourceFile:52)

sigmaxipi commented 5 years ago

This is a bug in the JNI interface due to a typo. The JNI code says

JNI_EXPORT void JNI_WRAPPER(EnableSpeakerStereoMode)(JNIEnv* env, jobject obj,
                                                     jlong j_ptr,
                                                     jboolean enable) {
  const VrAudioSystem* const vr_audio_system = NativePtrFromJPtr(j_ptr);
  DCHECK(vr_audio_system);
  vr_audio_system->vr_audio->EnableStereoSpeakerMode(enable);
}

but the Java code says private native void nativeEnableStereoSpeakerMode(long vrAudioSystemRef, boolean enable);

As a temporary workaround, you could create a JNI function called Java_com_google_vr_sdk_audio_GvrAudioEngine_nativeEnableStereoSpeakerMode which calls Java_com_google_vr_sdk_audio_GvrAudioEngine_nativeEnableSpeakerStereoMode.