itinance / react-native-fs

Native filesystem access for react-native
MIT License
4.97k stars 986 forks source link

Could not find method java.net.HttpURLConnection.getContentLengthLong #673

Open Komeyl94 opened 5 years ago

Komeyl94 commented 5 years ago

this error happens for me on android devices below 21 when downloading a file and makes the device crash. here's the logcat:

I/dalvikvm( 2936): Could not find method java.net.HttpURLConnection.getContentLengthLong, referenced from method com.rnfs.Downloader.download
W/dalvikvm( 2936): VFY: unable to resolve virtual method 7098: Ljava/net/HttpURLConnection;.getContentLengthLong ()J
D/dalvikvm( 2936): VFY: replacing opcode 0x6e at 0x0041
W/dalvikvm( 2936): threadid=113: thread exiting with uncaught exception (group=0xa4d74b20)
E/AndroidRuntime( 2936): FATAL EXCEPTION: Thread-285
E/AndroidRuntime( 2936): Process: com.emji.android, PID: 2936
E/AndroidRuntime( 2936): java.lang.NoSuchMethodError: java.net.HttpURLConnection.getContentLengthLong
E/AndroidRuntime( 2936):    at com.rnfs.Downloader.download(Downloader.java:67)
E/AndroidRuntime( 2936):    at com.rnfs.Downloader.access$100(Downloader.java:22)
E/AndroidRuntime( 2936):    at com.rnfs.Downloader$1.run(Downloader.java:34)
E/AndroidRuntime( 2936):    at java.lang.Thread.run(Thread.java:841)
W/ActivityManager(  594):   Force finishing activity com.emji.android/.MainActivity

does anyone have a solution for this?

Komeyl94 commented 5 years ago

I just fixed this by updating the package from 2.13.2 to 2.13.3 đŸ¤· ¯_(ăƒ„)_/¯

NikiLee2016 commented 5 years ago

Thanks. I was faced to that problem too.