我在我们的一个应用程序中发生了崩溃,并试图找出原因。
这似乎是由于资源字符不正确而发生的。因此,在阅读有关内容后,我发现在API 19及之前的版本中,某些非UTF8字符会引起麻烦。发生崩溃时,此字符串将显示:Loading document…
“ …
”等效于“ ...”,但我想知道这是否是引起麻烦的原因。可以吗这组字符对api 19及更早版本无效吗?
编辑: 我添加了PlayStore提供的跟踪信息(我所拥有的所有信息):
"main" tid=1 Native
"main" prio=5 tid=1 Native
| group="main" sCount=1 dsCount=0 obj=0x74b56000 self=0xb4df6500
| sysTid=12348 nice=0 cgrp=default sched=0/0 handle=0xb6fbcb34
| state=S schedstat=( 0 0 0 ) utm=806 stm=228 core=0 HZ=100
| stack=0xbe419000-0xbe41b000 stackSize=8MB
| held mutexes=
#00 pc 0000000000017618 /system/lib/libc.so (syscall+28)
#01 pc 00000000000f5ced /system/lib/libart.so (_ZN3art17ConditionVariable4WaitEPNS_6ThreadE+80)
#02 pc 0000000000267623 /system/lib/libart.so (_ZN3art3JNI12NewStringUTFEP7_JNIEnvPKc+610)
#03 pc 000000000008952d /system/lib/libandroid_runtime.so (???)
#04 pc 000000000042c6bf /data/dalvik-cache/arm/system@framework@boot.oat (Java_android_content_res_StringBlock_nativeGetString__JI+98)
at android.content.res.StringBlock.nativeGetString (Native method)
at android.content.res.StringBlock.get (StringBlock.java:82)
- locked <0x066e19ac> (a android.content.res.StringBlock)
at android.content.res.AssetManager.getResourceText (AssetManager.java:154)
- locked <0x0fbb8675> (a android.content.res.AssetManager)
at android.content.res.Resources.getText (Resources.java:308)
at android.content.res.Resources.getString (Resources.java:400)
at android.content.Context.getString (Context.java:409)
at cat.enterprise.appname.modules.documents.view.DocumentsActivity.insertUnlockPasswordDialog (DocumentsActivity.java:628)
at cat.enterprise.appname.modules.documents.view.DocumentsActivity.onDocumentClick (DocumentsActivity.java:544)
at cat.enterprise.appname.adapter.DocumentItemAdapter$1.onClick (DocumentItemAdapter.java:344)
at android.view.View.performClick (View.java:5204)
at android.view.View$PerformClick.run (View.java:21153)
at android.os.Handler.handleCallback (Handler.java:739)
at android.os.Handler.dispatchMessage (Handler.java:95)
at android.os.Looper.loop (Looper.java:148)
at android.app.ActivityThread.main (ActivityThread.java:5417)
at java.lang.reflect.Method.invoke! (Native method)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run (ZygoteInit.java:742)
at com.android.internal.os.ZygoteInit.main (ZygoteInit.java:632)
"FinalizerDaemon" tid=3 Waiting
"ReferenceQueueDaemon" tid=4 Waiting
"FinalizerWatchdogDaemon" tid=5 Waiting
"Binder_1" tid=7 Native
"Binder_2" tid=8 Native
"AsyncTask #1" tid=9 Waiting
"AsyncTask #2" tid=10 Waiting
"AsyncTask #3" tid=11 Waiting
"AsyncTask #4" tid=12 Waiting
"AsyncTask #5" tid=13 Waiting
"Okio Watchdog" tid=14 Waiting
"pool-2-thread-1" tid=15 Waiting
"RealmFinalizingDaemon" tid=16 Waiting
"Binder_3" tid=17 Native
"estiona.appname"
"Signal Catcher" tid=2 Runnable
谢谢
答案 0 :(得分:0)
添加一个values-v19/strings.xml
,但不包含U+2026
,如果出现相似的字符,则进一步出现。
<?xml version="1.0" encoding="UTF-8"?>
<resources xmlns:tools="http://schemas.android.com/tools">
<string name="loading_text" tools:ignore="TypographyEllipsis">Loading document...</string>
</resources>
由于JNI UTF-8 encoding bug with some characters,可能是字符超出范围。