標籤:android style blog http color io java ar for
在sdcard中建立接收檔案名字時候,由於檔案名稱編碼的問題導致下面的錯誤。
01-01 08:10:11.054: W/dalvikvm(1824): JNI WARNING: illegal continuation byte 0xd201-01 08:10:11.054: W/dalvikvm(1824): string: ‘???.docx‘01-01 08:10:11.054: W/dalvikvm(1824): in Ljava/io/File;.listImpl (Ljava/lang/String;)[Ljava/lang/String; (NewStringUTF)01-19 14:33:39.573: I/dalvikvm(566): "main" prio=5 tid=1 NATIVE01-19 14:33:39.573: I/dalvikvm(566): | group="main" sCount=0 dsCount=0 obj=0x40997460 self=0x1281001-19 14:33:39.573: I/dalvikvm(566): | sysTid=566 nice=0 sched=0/0 cgrp=default handle=107408295201-19 14:33:39.573: I/dalvikvm(566): | schedstat=( 334860174 892884911 75 ) utm=13 stm=20 core=001-19 14:33:39.573: I/dalvikvm(566): at java.io.File.listImpl(Native Method)01-19 14:33:39.573: I/dalvikvm(566): at java.io.File.list(File.java:749)01-19 14:33:39.573: I/dalvikvm(566): at java.io.File.listFiles(File.java:791)
在網上找了一個可能解決的辦法,修改checkjni.c檔案。但是感覺不是特別靠譜。具體沒有嘗試這種方法可不行不。通過搜尋相關錯誤,我堅信應該是字串編碼問題導致。在參考這個貼子,完美解決了這個問題。這個文章連結:https://groups.google.com/forum/#!topic/android-developers/y4lyEccZ--g
在文章提供解決的方法:
Convert this string into UTF-8 first,then call NewStringUTF
eg:fileName=new String(fileName.getBytes(), "UTF-8");
Android JNI WARNING: illegal continuation byte 0xd2