Ganesh Kanna
Ganesh Kanna

Reputation: 2275

File.listFiles crashes for invalid UTF-8 characters

The App crashed while navigating files within directory. crash log as follows:

JNI DETECTED ERROR IN APPLICATION: input is not valid Modified UTF-8: illegal start byte 0xf6
art/runtime/check_jni.cc:65]     string: 'Test Color.X7��37meaba'

java.io.File.list(File.java:742)
java.io.File.listFiles(File.java:784)

Upvotes: 4

Views: 1792

Answers (2)

Jibbo
Jibbo

Reputation: 442

If this happens for files OUTSIDE (not bundled in) your apk, just test on a real device. For me the emulator was causing the issue.

Upvotes: 0

Ganesh Kanna
Ganesh Kanna

Reputation: 2275

Sign the apk before running for this case to avoid crash.

Upvotes: 5

Related Questions