Android JNI WARNING: illegal continuation byte 0xd2

來源:互聯網
上載者:User

標籤: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

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.