hello, I'm trying to recreate the ARCore java sample to my application and face this crash when calling this line
if (trackable instanceof Plane && ((Plane) trackable).isPoseInPolygon(hit.getHitPose()))
This is the crash log
art/runtime/java_vm_ext.cc:470] JNI DETECTED ERROR IN APPLICATION: fid == null
art/runtime/java_vm_ext.cc:470] in call to GetObjectField
art/runtime/java_vm_ext.cc:470] from boolean com.google.ar.core.Plane.nativeIsPoseInPolygon(long, long, com.google.ar.core.Pose)
art/runtime/java_vm_ext.cc:470] "Thread-3613" prio=7 tid=40 Runnable
art/runtime/java_vm_ext.cc:470] | group="main" sCount=0 dsCount=0 obj=0x12fb2160 self=0xb8092c00
art/runtime/java_vm_ext.cc:470] | sysTid=2259 nice=-4 cgrp=default sched=0/0 handle=0xc1c62920
art/runtime/java_vm_ext.cc:470] | state=R schedstat=( 19705392420 965329788 7117 ) utm=1647 stm=323 core=6 HZ=100
art/runtime/java_vm_ext.cc:470] | stack=0xc1b66000-0xc1b68000 stackSize=1014KB
art/runtime/java_vm_ext.cc:470] | held mutexes= "mutator lock"(shared held)
art/runtime/java_vm_ext.cc:470] native: #00 pc 003799fd /system/lib/libart.so (_ZN3art15DumpNativeStackERNSt3__113basic_ostreamIcNS0_11char_traitsIcEEEEiP12BacktraceMapPKcPNS_9ArtMethodEPv+128)
art/runtime/java_vm_ext.cc:470] native: #01 pc 00359705 /system/lib/libart.so (_ZNK3art6Thread9DumpStackERNSt3__113basic_ostreamIcNS1_11char_traitsIcEEEEbP12BacktraceMap+304)
art/runtime/java_vm_ext.cc:470] native: #02 pc 0025293d /system/lib/libart.so (_ZN3art9JavaVMExt8JniAbortEPKcS2_+812)
art/runtime/java_vm_ext.cc:470] native: #03 pc 00252c01 /system/lib/libart.so (_ZN3art9JavaVMExt9JniAbortFEPKcS2_z+72)
art/runtime/java_vm_ext.cc:470] native: #04 pc 0028b891 /system/lib/libart.so (_ZN3art3JNI14GetObjectFieldEP7_JNIEnvP8_jobjectP9_jfieldID+508)
art/runtime/java_vm_ext.cc:470] native: #05 pc 00010498 /data/app/com.test.arcore-1/lib/arm/libarcore_sdk.so (???)
art/runtime/java_vm_ext.cc:470] native: #06 pc 0000fba8 /data/app/com.test.arcore-1/lib/arm/libarcore_sdk.so (Java_com_google_ar_core_Plane_nativeIsPoseInPolygon+40)
art/runtime/java_vm_ext.cc:470] native: #07 pc 0007f16d /data/app/com.test.arcore-1/oat/arm/base.odex (Java_com_google_ar_core_Plane_nativeIsPoseInPolygon__JJLcom_google_ar_core_Pose_2+136)
art/runtime/java_vm_ext.cc:470] at com.google.ar.core.Plane.nativeIsPoseInPolygon(Native method)
art/runtime/java_vm_ext.cc:470] at com.google.ar.core.Plane.a(SourceFile:147)
art/runtime/java_vm_ext.cc:470] at com.test.augmentedreality.AugmentedReality.UpdateAR(SourceFile:424)
art/runtime/java_vm_ext.cc:470]
art/runtime/runtime.cc:419] Runtime aborting...
art/runtime/runtime.cc:419] Aborting thread:
art/runtime/runtime.cc:419] "Thread-3613" prio=7 tid=40 Native
art/runtime/runtime.cc:419] | group="" sCount=0 dsCount=0 obj=0x12fb2160 self=0xb8092c00
art/runtime/runtime.cc:419] | sysTid=2259 nice=-4 cgrp=default sched=0/0 handle=0xc1c62920
art/runtime/runtime.cc:419] | state=R schedstat=( 19728281118 967387236 7126 ) utm=1647 stm=325 core=7 HZ=100
art/runtime/runtime.cc:419] | stack=0xc1b66000-0xc1b68000 stackSize=1014KB
art/runtime/runtime.cc:419] | held mutexes= "abort lock"
art/runtime/runtime.cc:419] native: #00 pc 003799fd /system/lib/libart.so (_ZN3art15DumpNativeStackERNSt3__113basic_ostreamIcNS0_11char_traitsIcEEEEiP12BacktraceMapPKcPNS_9ArtMethodEPv+128)
art/runtime/runtime.cc:419] native: #01 pc 00359705 /system/lib/libart.so (_ZNK3art6Thread9DumpStackERNSt3__113basic_ostreamIcNS1_11char_traitsIcEEEEbP12BacktraceMap+304)
art/runtime/runtime.cc:419] native: #02 pc 0034c3ad /system/lib/libart.so (_ZNK3art10AbortState10DumpThreadERNSt3__113basic_ostreamIcNS1_11char_traitsIcEEEEPNS_6ThreadE+24)
art/runtime/runtime.cc:419] native: #03 pc 0034c229 /system/lib/libart.so (_ZNK3art10AbortState4DumpERNSt3__113basic_ostreamIcNS1_11char_traitsIcEEEE+424)
art/runtime/runtime.cc:419] native: #04 pc 00342c2b /system/lib/libart.so (_ZN3art7Runtime5AbortEv+90)
art/runtime/runtime.cc:419] native: #05 pc 000b6b57 /system/lib/libart.so (_ZN3art10LogMessageD2Ev+870)
art/runtime/runtime.cc:419] native: #06 pc 00252adb /system/lib/libart.so (_ZN3art9JavaVMExt8JniAbortEPKcS2_+1226)
art/runtime/runtime.cc:419] native: #07 pc 00252c01 /system/lib/libart.so (_ZN3art9JavaVMExt9JniAbortFEPKcS2_z+72)
art/runtime/runtime.cc:419] native: #08 pc 0028b891 /system/lib/libart.so (_ZN3art3JNI14GetObjectFieldEP7_JNIEnvP8_jobjectP9_jfieldID+508)
art/runtime/runtime.cc:419] native: #09 pc 00010498 /data/app/com.test.arcore-1/lib/arm/libarcore_sdk.so (???)
art/runtime/runtime.cc:419] native: #10 pc 0000fba8 /data/app/com.test.arcore-1/lib/arm/libarcore_sdk.so (Java_com_google_ar_core_Plane_nativeIsPoseInPolygon+40)
art/runtime/runtime.cc:419] native: #11 pc 0007f16d /data/app/com.test.arcore-1/oat/arm/base.odex (???)
art/runtime/runtime.cc:419] at com.google.ar.core.Plane.nativeIsPoseInPolygon(Native method)
art/runtime/runtime.cc:419] at com.google.ar.core.Plane.a(SourceFile:147)
art/runtime/runtime.cc:419] at com.test.augmentedreality.AugmentedReality.UpdateAR(SourceFile:424)
Is there anything I miss?
Thanks
If you disable proguard does this still happen? It looks like there's an issue accessing internal fields of the Pose object.
If disabling proguard fixes it, this should be fixed for real for 1.0.
Until then, try adding this to your proguard rules:
-keepclassmembers class com.google.ar.core.Pose {
private <fields>;
}
To add to this, I also needed to include the following to my proguard rules:
-keepclassmembers public class com.google.ar.core.Session {
static <methods>;
}
Session#throwExceptionFromArStatus seems to be called from native code, but neither the class nor method were annotated with com.google.ar.core.annotations.UsedByNative.
Thanks! We're working on adding a thorough API test with a proguarded app to make sure these all get caught, but don't hesitate to report more just in case we miss some.
Thanks for the help, turning off proguard fix the crash, but when using above rules my application still crashing, so for now I use this rule
-keepclassmembers class com.google.ar.core.** { *; }
Great to hear!
I have had similar crash:
02-05 12:52:52.678 9817-10544/? A/libc: Fatal signal 6 (SIGABRT), code -6 in tid 10544 (CameraFrameDisp), pid 9817 (t.android.alpha)
02-05 12:52:52.781 10792-10792/? A/DEBUG: *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** ***
02-05 12:52:52.781 10792-10792/? A/DEBUG: Build fingerprint: 'google/walleye/walleye:8.1.0/OPM1.171019.013/4474084:user/release-keys'
02-05 12:52:52.781 10792-10792/? A/DEBUG: Revision: 'MP1'
02-05 12:52:52.781 10792-10792/? A/DEBUG: ABI: 'arm'
02-05 12:52:52.781 10792-10792/? A/DEBUG: pid: 9817, tid: 10544, name: CameraFrameDisp >>> com.snapchat.android.alpha <<<
02-05 12:52:52.781 10792-10792/? A/DEBUG: signal 6 (SIGABRT), code -6 (SI_TKILL), fault addr --------
02-05 12:52:52.787 10792-10792/? A/DEBUG: Abort message: '[java/com/google/vr/dynamite/client/native/dynamite_client.cc:39] CHECK failed: expression='"library_loader_class"' Failed to find DynamiteClient class'
02-05 12:52:52.788 10792-10792/? A/DEBUG: r0 00000000 r1 00002930 r2 00000006 r3 00000008
02-05 12:52:52.788 10792-10792/? A/DEBUG: r4 00002659 r5 00002930 r6 b9b6cdf4 r7 0000010c
02-05 12:52:52.788 10792-10792/? A/DEBUG: r8 00000000 r9 9ceac740 sl 9ced5e91 fp b9b6d6f4
02-05 12:52:52.788 10792-10792/? A/DEBUG: ip 9ceac740 sp b9b6cde0 lr e8326c89 pc e8320772 cpsr 200f0030
02-05 12:52:52.789 10792-10792/? A/DEBUG: backtrace:
02-05 12:52:52.789 10792-10792/? A/DEBUG: #00 pc 0001a772 /system/lib/libc.so (abort+63)
02-05 12:52:52.789 10792-10792/? A/DEBUG: #01 pc 0002133c /data/app/com.snapchat.android.alpha-L52sMOg4YtQ1luyfZyTx6w==/lib/arm/libarcore_sdk.so (ion::port::BreakOrAbort()+24)
02-05 12:52:52.789 10792-10792/? A/DEBUG: #02 pc 00020384 /data/app/com.snapchat.android.alpha-L52sMOg4YtQ1luyfZyTx6w==/lib/arm/libarcore_sdk.so (ion::base::logging_internal::(anonymous namespace)::BreakOnFatalSeverity(ion::port::LogSeverity)+244)
02-05 12:52:52.789 10792-10792/? A/DEBUG: #03 pc 0002025c /data/app/com.snapchat.android.alpha-L52sMOg4YtQ1luyfZyTx6w==/lib/arm/libarcore_sdk.so (ion::base::logging_internal::Logger::~Logger()+100)
02-05 12:52:52.789 10792-10792/? A/DEBUG: #04 pc 0001e22c /data/app/com.snapchat.android.alpha-L52sMOg4YtQ1luyfZyTx6w==/lib/arm/libarcore_sdk.so (CheckVersion(char const*, char const*, char const*)+160)
02-05 12:52:52.789 10792-10792/? A/DEBUG: #05 pc 0000d974 /data/app/com.snapchat.android.alpha-L52sMOg4YtQ1luyfZyTx6w==/lib/arm/libarcore_sdk.so (ArSession_create+136)
02-05 12:52:52.789 10792-10792/? A/DEBUG: #06 pc 0000fca4 /data/app/com.snapchat.android.alpha-L52sMOg4YtQ1luyfZyTx6w==/lib/arm/libarcore_sdk.so (Java_com_google_ar_core_Session_nativeCreateSession+28)
02-05 12:52:52.789 10792-10792/? A/DEBUG: #07 pc 000e3e41 /data/app/com.snapchat.android.alpha-L52sMOg4YtQ1luyfZyTx6w==/oat/arm/base.odex (offset 0xe0000)
ArCore was not able to find DynamiteClient - com.google.vr.dynamite.client.DynamiteClient
Solution add also com.google.vr.** to proguard exceptions.
-keep class com.google.ar.** { *; }
-keep class com.google.vr.** { *; }
This should be fixed with the 1.0 client library released today. Update your build to grab the AAR from the Google Maven repo and proguard should start working. The AAR includes appropriate proguard rules.
Hi, @oleksandroparasc, I had meet the similar problem with arcore 1.0
03-18 10:06:48.757 13354-13372/com.example.arcore_example A/Ion: [java/com/google/vr/dynamite/client/native/dynamite_client.cc:39] CHECK failed: expression='"library_loader_class"' Failed to find DynamiteClient class
03-18 10:06:48.757 13354-13372/com.example.arcore_example A/Ion: Dumping stack:
03-18 10:06:48.757 13354-13372/com.example.arcore_example A/libc: Fatal signal 6 (SIGABRT), code -6 in tid 13372 (Thread-2)
03-18 10:06:48.797 13375-13375/? A/DEBUG: pid: 13354, tid: 13372, name: Thread-2 >>> com.example.arcore_example <<<
03-18 10:06:48.805 13375-13375/? A/DEBUG: #02 pc 0001ce44 /data/app/com.example.arcore_example-QOwylZv7698cIiWfnuzR3w==/lib/arm/libarcore_sdk.so
03-18 10:06:48.805 13375-13375/? A/DEBUG: #03 pc 0001c34c /data/app/com.example.arcore_example-QOwylZv7698cIiWfnuzR3w==/lib/arm/libarcore_sdk.so
03-18 10:06:48.805 13375-13375/? A/DEBUG: #04 pc 0001c23c /data/app/com.example.arcore_example-QOwylZv7698cIiWfnuzR3w==/lib/arm/libarcore_sdk.so
03-18 10:06:48.805 13375-13375/? A/DEBUG: #05 pc 0001a0cc /data/app/com.example.arcore_example-QOwylZv7698cIiWfnuzR3w==/lib/arm/libarcore_sdk.so
03-18 10:06:48.805 13375-13375/? A/DEBUG: #06 pc 00016418 /data/app/com.example.arcore_example-QOwylZv7698cIiWfnuzR3w==/lib/arm/libarcore_sdk.so (ArSession_create+132)
03-18 10:06:48.805 13375-13375/? A/DEBUG: #07 pc 0003c228 /data/app/com.example.arcore_example-QOwylZv7698cIiWfnuzR3w==/lib/arm/libmain.so
03-18 10:06:48.805 13375-13375/? A/DEBUG: #08 pc 0003bce4 /data/app/com.example.arcore_example-QOwylZv7698cIiWfnuzR3w==/lib/arm/libmain.so
03-18 10:06:48.805 13375-13375/? A/DEBUG: #09 pc 0006ee78 /data/app/com.example.arcore_example-QOwylZv7698cIiWfnuzR3w==/lib/arm/libmain.so
03-18 10:06:48.805 13375-13375/? A/DEBUG: #10 pc 000afed8 /data/app/com.example.arcore_example-QOwylZv7698cIiWfnuzR3w==/lib/arm/libmain.so (__rust_maybe_catch_panic+32)
03-18 10:06:48.806 13375-13375/? A/DEBUG: #11 pc 0007e794 /data/app/com.example.arcore_example-QOwylZv7698cIiWfnuzR3w==/lib/arm/libmain.so (_ZN3std2rt19lang_start_internal17h104139376fdb9eadE+168)
03-18 10:06:48.806 13375-13375/? A/DEBUG: #12 pc 0003bca8 /data/app/com.example.arcore_example-QOwylZv7698cIiWfnuzR3w==/lib/arm/libmain.so
03-18 10:06:48.806 13375-13375/? A/DEBUG: #13 pc 0003c3fc /data/app/com.example.arcore_example-QOwylZv7698cIiWfnuzR3w==/lib/arm/libmain.so (main+80)
03-18 10:06:48.806 13375-13375/? A/DEBUG: #14 pc 00119198 /data/app/com.example.arcore_example-QOwylZv7698cIiWfnuzR3w==/lib/arm/libmain.so
03-18 10:06:48.806 13375-13375/? A/DEBUG: #15 pc 0010e724 /data/app/com.example.arcore_example-QOwylZv7698cIiWfnuzR3w==/lib/arm/libmain.so
03-18 10:06:49.418 907-1201/? E/InputDispatcher: channel 'cead476 com.example.arcore_example/rust.arcore_example.MainActivity (server)' ~ Channel is unrecoverably broken and will be disposed!
And also add
-keep class com.google.ar.** { *; }
-keep class com.google.vr.** { *; }
to proguard-rules.pro, but the error remains.
@yangchengjian Open you apk in Android Studio and make sure that you have classed under
com.google.ar.* and class com.google.vr.* not renamed via proguard.
In v1.0 they have added pro-guard rules to aar, but there is another problem with that rules: they have global optimization option that is not compatible with dx8.(another topic), so I have I am successfully using this pro-guard with v1.0 as well.
@yangchengjian I would recommend you take arcore sample app and enable proguard there and check if it works for you in sample app with my pro-guard rules
@yangchengjian Are you building the ARCore AAR directly into your release app? Repackaging it through an intermediate library build can drop the proguard rules it contains. You shouldn't need any explicit keep rules - they come bundled inside the AAR.
@inio @HEAlex , I have solved the problem now. Thank you very much.
I have the same problem on Unity when I launch my AR sc猫ne with Proguard activated. (Release and development)
I tried all the rules above in my proguard-user.txt but it has no effect.
Most helpful comment
I have had similar crash:
ArCore was not able to find DynamiteClient - com.google.vr.dynamite.client.DynamiteClient
Solution add also com.google.vr.** to proguard exceptions.