Reputation: 173
I am getting the following error when I integrate Cardboard in my android application. ( I am running it on Samsung S6/Note 3/Nexus 6)
... D/CardboardViewNativeImpl﹕ NativeProxy not found
... D/CardboardViewNativeImpl﹕ Loading native library vrtoolkit
... D/CardboardViewNativeImpl﹕ Native library loaded
... W/art﹕ Attempt to remove local handle scope entry from IRT, ignoring
... W/art﹕ Attempt to remove local handle scope entry from IRT, ignoring
... W/art﹕ Attempt to remove local handle scope entry from IRT, ignoring
... A/art﹕ art/runtime/check_jni.cc:65] JNI DETECTED ERROR IN APPLICATION: GetMethodID received null jclass
... A/art﹕ art/runtime/check_jni.cc:65] in call to GetMethodID
... A/art﹕ art/runtime/check_jni.cc:65] from long com.google.vrtoolkit.cardboard.CardboardViewNativeImpl.nativeInit(int, int, float, float, float, long)
... A/art﹕ art/runtime/check_jni.cc:65] "main" prio=5 tid=1 Runnable
... A/art﹕ art/runtime/check_jni.cc:65] | group="main" sCount=0 dsCount=0 obj=0x73617000 self=0xb4827800
... A/art﹕ art/runtime/check_jni.cc:65] | sysTid=24304 nice=0 cgrp=default sched=0/0 handle=0xb6f04bec
... A/art﹕ art/runtime/check_jni.cc:65] | state=R schedstat=( 1668176075 289166273 1700 ) utm=148 stm=18 core=1 HZ=100
... A/art﹕ art/runtime/check_jni.cc:65] | stack=0xbe04a000-0xbe04c000 stackSize=8MB
... A/art﹕ art/runtime/check_jni.cc:65] | held mutexes= "mutator lock"(shared held)
I have also the added abiFilters, since cardbaord.jar file has the .so file only for armeabi-v7a. But still getting the error.
buildTypes {
debug {
...
ndk {
abiFilters "armeabi-v7a" // includes ARM SO files only, so no x86 SO file
}
}
I was able to create a standalone cardbaord application and run it on all three devices without issue, only when I integrate with the existing app its failing at runtime.
Upvotes: 1
Views: 586
Reputation: 6583
For new Cardboard SDK 0.8.0 I had to add the following ProGuard rules:
-keep class com.google.vr.**
-keepclassmembers class com.google.vr.** { *; }
-keep class com.google.vr.**$*
-keepclassmembers class com.google.vr.**$* { *; }
-keep class com.google.geo.render.**
-keepclassmembers class com.google.geo.render.** { *; }
# Also keept this rule, just in case (probably only needed for 0.7.0)
-keep class com.google.vrtoolkit.cardboard.** { *; }
I was a bit in a hurry, and because of that maybe I've been too "conservative" on the rules. I've checked it on both panowidget (still image) and videowidget (video) examples and it works in both cases.
Upvotes: 0
Reputation: 1210
I have this exact same problem that it works when it's standalone, but breaks with "GetMethodID received null jclass" when I integrate it to an existing app.
It turns out I have ProGuard enabled in the integrated app, adding the following rule fixed it:
-keep class com.google.vrtoolkit.cardboard.** { *; }
Upvotes: 2