You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Some https URLs request fails on android 4 with no error while it's working on other androids (I've tested on some phones and it fails on 4.4.2 while successful on 5.0.2, 6.0.1, 9)
Reproducible Demo
Create a project and paste the following code into your App.js. Make sure you are running on a device with android 4.4.2. It seems working on android 5+.
import React, {Component} from 'react';
import {Text, View} from 'react-native';
export default class App extends Component {
componentDidMount() {
/* this request fails on android 4 while its working on android 5+*/
fetch('https://jsonplaceholder.typicode.com/posts/1')
.then(resp => resp.json())
.then(json => alert(`fail -> ${JSON.stringify(json)}`))
.catch(err => {
console.log(err)
})
/* this one is successful even on android 4 */
fetch('https://www.json-generator.com/api/json/get/clfvuKZzOq?indent=2')
.then(resp => resp.json())
.then(json => alert(`success -> ${JSON.stringify(json)}`))
}
render() {
return (
<View style={{flex: 1, justifyContent: 'center', alignItems: 'center'}}>
<Text>https error on android 4</Text>
</View>
);
}
}
I fixed this problem based on this issue and this gist. I don't know if this issue should remain open or not. It's clearly a problem. Anyway, Here's RN fix to it.
Activity
seriiix commentedon Jan 25, 2019
I fixed this problem based on this issue and this gist. I don't know if this issue should remain open or not. It's clearly a problem. Anyway, Here's RN fix to it.
use Conscrypt as security provider if available (#23984)
use Conscrypt as security provider if available (#23984)
dulmandakh commentedon Apr 1, 2019
it's fixed with fab86ee, please see commit description.