请帮助我,我在我的应用程序中使用sinch sdk并且它在除了android棒棒糖之外的所有Android平台上正常运行,当我尝试打开它时强制关闭。 这是日志:
12-26 01:33:00.577: A/art(5423): art/runtime/check_jni.cc:65] JNI DETECTED ERROR IN APPLICATION: attempt to return an instance of com.sinch.android.rtc.internal.natives.jni.NativeServiceProviderImpl from com.sinch.android.rtc.internal.natives.jni.NativeServiceProviderImpl com.sinch.android.rtc.internal.natives.jni.ServiceProviderFactory.createServiceProvider(com.sinch.android.rtc.internal.service.dispatcher.Dispatcher, com.sinch.android.rtc.internal.service.http.HttpService, com.sinch.android.rtc.internal.service.pubnub.PubSubClient, com.sinch.android.rtc.internal.service.uniqueid.UniqueId, com.sinch.android.rtc.internal.service.crypto.CryptoService, com.sinch.android.rtc.internal.service.persistence.PersistenceService)
12-26 01:33:00.577: A/art(5423): art/runtime/check_jni.cc:65] from com.sinch.android.rtc.internal.natives.jni.NativeServiceProviderImpl com.sinch.android.rtc.internal.natives.jni.ServiceProviderFactory.createServiceProvider(com.sinch.android.rtc.internal.service.dispatcher.Dispatcher, com.sinch.android.rtc.internal.service.http.HttpService, com.sinch.android.rtc.internal.service.pubnub.PubSubClient, com.sinch.android.rtc.internal.service.uniqueid.UniqueId, com.sinch.android.rtc.internal.service.crypto.CryptoService, com.sinch.android.rtc.internal.service.persistence.PersistenceService)
12-26 01:33:00.577: A/art(5423): art/runtime/check_jni.cc:65] "main" prio=5 tid=1 Runnable
12-26 01:33:00.577: A/art(5423): art/runtime/check_jni.cc:65] | group="main" sCount=0 dsCount=0 obj=0x86eafef0 self=0xb4e07800
12-26 01:33:00.577: A/art(5423): art/runtime/check_jni.cc:65] | sysTid=5423 nice=-11 cgrp=apps sched=0/0 handle=0xb6f5aec8
12-26 01:33:00.577: A/art(5423): art/runtime/check_jni.cc:65] | state=R schedstat=( 284397663 94742126 1467 ) utm=18 stm=10 core=2 HZ=100
12-26 01:33:00.577: A/art(5423): art/runtime/check_jni.cc:65] | stack=0xbe5dc000-0xbe5de000 stackSize=8MB
12-26 01:33:00.577: A/art(5423): art/runtime/check_jni.cc:65] | held mutexes= "mutator lock"(shared held)
12-26 01:33:00.577: A/art(5423): art/runtime/check_jni.cc:65] native: #00 pc 00004640 /system/lib/libbacktrace_libc++.so (UnwindCurrent::Unwind(unsigned int, ucontext)+23)
12-26 01:33:00.577: A/art(5423): art/runtime/check_jni.cc:65] native: #1 pc 00002e8d /system/lib/libbacktrace_libc++.so (Backtrace::Unwind(unsigned int, ucontext)+8)
12-26 01:33:00.577: A/art(5423): art/runtime/check_jni.cc:65] native: #2 pc 00244bd9 /system/lib/libart.so (art::DumpNativeStack(std::__1::basic_ostream >&, int, char const, art::mirror::ArtMethod)+68)
12-26 01:33:00.577: A/art(5423): art/runtime/check_jni.cc:65] native: #3 pc 0022997f /system/lib/libart.so (art::Thread::Dump(std::__1::basic_ostream >&) const+146)
12-26 01:33:00.577: A/art(5423): art/runtime/check_jni.cc:65] native: #4 pc 000b0cdb /system/lib/libart.so (art::JniAbort(char const, char const)+582)
12-26 01:33:00.577: A/art(5423): art/runtime/check_jni.cc:65] native: #5 pc 000b1415 /system/lib/libart.so (art::JniAbortF(char const, char const, ...)+60)
12-26 01:33:00.577: A/art(5423): art/runtime/check_jni.cc:65] native: #6 pc 002634ff /system/lib/libart.so (art::CheckReferenceResult(art::mirror::Object, art::Thread)+486)
12-26 01:33:00.577: A/art(5423): art/runtime/check_jni.cc:65] native: #07 pc 000874f3 /system/lib/libart.so (art::JniMethodEndWithReference(_jobject, unsigned int, art::Thread)+62)
12-26 01:33:00.577: A/art(5423): art/runtime/check_jni.cc:65] native: #08 pc 002dfdf1 /data/dalvik-cache/arm/data@app@com.galsa.example-2@base.apk@classes.dex (Java_com_sinch_android_rtc_internal_natives_jni_ServiceProviderFactory_createServiceProvider__Lcom_sinch_android_rtc_internal_service_dispatcher_Dispatcher_2Lcom_sinch_android_rtc_internal_service_http_HttpService_2Lcom_sinch_android_rtc_internal_service_pubnub_PubSubClient_2Lcom_sinch_android_rtc_internal_service_uniqueid_UniqueId_2Lcom_sinch_android_rtc_internal_service_crypto_CryptoService_2Lcom_sinch_android_rtc_internal_service_persistence_PersistenceService_2+240)
12-26 01:33:00.577: A/art(5423): art/runtime/check_jni.cc:65] at com.sinch.android.rtc.internal.natives.jni.ServiceProviderFactory.createServiceProvider(Native method)
12-26 01:33:00.577: A/art(5423): art/runtime/check_jni.cc:65] at com.sinch.android.rtc.internal.service.serviceprovider.DefaultServiceProvider.(DefaultServiceProvider.java:24)
12-26 01:33:00.577: A/art(5423): art/runtime/check_jni.cc:65] at com.sinch.android.rtc.internal.client.DefaultSinchClient.(DefaultSinchClient.java:147)
12-26 01:33:00.577: A/art(5423): art/runtime/check_jni.cc:65] at com.sinch.android.rtc.internal.client.InternalSinchClientFactory.createSinchClient(InternalSinchClientFactory.java:17)
12-26 01:33:00.577: A/art(5423): art/runtime/check_jni.cc:65] - locked (a java.lang.Class)
12-26 01:33:00.577: A/art(5423): art/runtime/check_jni.cc:65] at com.sinch.android.rtc.DefaultSinchClientBuilder.build(DefaultSinchClientBuilder.java:95)
12-26 01:33:00.577: A/art(5423): art/runtime/check_jni.cc:65] at call.SinchClientService.startSinchClient(SinchClientService.java:194)
12-26 01:33:00.577: A/art(5423): art/runtime/check_jni.cc:65] at call.SinchClientService.onCreate(SinchClientService.java:138)
12-26 01:33:00.577: A/art(5423): art/runtime/check_jni.cc:65] at android.app.ActivityThread.handleCreateService(ActivityThread.java:3102)
12-26 01:33:00.577: A/art(5423): art/runtime/check_jni.cc:65] at android.app.ActivityThread.access$1900(ActivityThread.java:172)
12-26 01:33:00.577: A/art(5423): art/runtime/check_jni.cc:65] at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1505)
12-26 01:33:00.577: A/art(5423): art/runtime/check_jni.cc:65] at android.os.Handler.dispatchMessage(Handler.java:102)
12-26 01:33:00.577: A/art(5423): art/runtime/check_jni.cc:65] at android.os.Looper.loop(Looper.java:145)
12-26 01:33:00.577: A/art(5423): art/runtime/check_jni.cc:65] at android.app.ActivityThread.main(ActivityThread.java:5834)
12-26 01:33:00.577: A/art(5423): art/runtime/check_jni.cc:65] at java.lang.reflect.Method.invoke!(Native method)
12-26 01:33:00.577: A/art(5423): art/runtime/check_jni.cc:65] at java.lang.reflect.Method.invoke(Method.java:372)
12-26 01:33:00.577: A/art(5423): art/runtime/check_jni.cc:65] at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1388)
12-26 01:33:00.577: A/art(5423): art/runtime/check_jni.cc:65] at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1183)
12-26 01:33:00.577: A/art(5423): art/runtime/check_jni.cc:65]
帮助将不胜感激。
答案 0 :(得分:6)
我假设你只是在Galaxy S5上看到这个,如果没有,请告诉我。
根据我的研究,三星已经对安装过程(dex2oat等)或ART进行了某些事情,这使得它的行为与其他所有制造商的行为不同。
无论出于何种原因,对于给定的类A,与从纯Java实例化的对象相比,从JNI层实例化的任何对象都被报告为具有不同的类。 这在CheckJNI被禁用时工作正常,因为类实际上是相同的,但是当启用CheckJNI时它会抱怨(当调试它时,似乎从S5上的JNI层实例化的任何类实际上是不同dexcache的一部分 - 这不是例如Nexus 5运行L)。
TL; DR :在使用Android L的S5上CheckJNI似乎出现故障。在发布模式下构建应用程序会禁用CheckJNI,一切都按预期工作。