albfernandez / juniversalchardet

Originally exported from code.google.com/p/juniversalchardet
Other
339 stars 60 forks source link

createBufferedReader needs toPath (API26+), but no warning / error #25

Closed tobiasKaminsky closed 5 years ago

tobiasKaminsky commented 6 years ago

We implemented this library in our app, which is minSdk=14. On Android 8 it is working fine, but on Android 6 it is crashing as https://developer.android.com/reference/java/io/File#toPath() was introduced at API26.

This should be shown to devs, preferred by @RequiresAPI annotation, or fixed so that it is compatible with older API.

albfernandez commented 6 years ago

this was introduced in

https://github.com/albfernandez/juniversalchardet/pull/24

As a temporary workaround you can use version 2.1.0 (the unique change in 2.2.0 is allow Path as parameter)

tobiasKaminsky commented 6 years ago

Thank you for your quick reply, I'll downgrade for now

tobiasKaminsky commented 6 years ago

I needed to downgrade to 2.0.0 as 2.1.0 crashed on a different code line, but also due to "toPath".

albfernandez commented 6 years ago

I think the max version you can use is 2.0.1, newer versions have incompatible API changes.

All changes for 2.1 and 2.2 are for new APIS, so you don't need them.

I'll make a branch for 2.0.x to support Android 4 for a while, backporting bug fixes, etc.

And most important, I'll add a compatibility section in the README

tobiasKaminsky commented 6 years ago

Thank you very much, I highly appreciate this :+1: