React-native: Can't show remote images in release mode on android device

Created on 6 May 2019  路  3Comments  路  Source: facebook/react-native

im runing a simple react-native application in my android device (samsung 9, Android 9, API 28), so on debug mode it's work fine using this commande line :

react-native run-android

this is the result :

https://i.imgur.com/KUmkaIo.png

but in relase mode (react-native run-android --variant=release) , image not showing :

https://i.imgur.com/UPiv16j.png

my simple code :

export default class App extends Component {
  render() {
    return (
      <View style={styles.container}>
      <Image source={ {uri:'http://i.imgur.com/GRIZj68.png'} } style={{width:200,height:200} } />
      <Text>HOLA</Text>  
      </View>
    );
  }
}
Bug Image Android Ran Commands Locked

Most helpful comment

Android pie (9) doesn't allow non https images to be rendered, so you have to change your http requests to https or to set a networkSecurityConfig in your Manifest application tag like this:

<?xml version="1.0" encoding="utf-8"?>
<manifest ... >
    <application android:networkSecurityConfig="@xml/network_security_config">
    </application>
</manifest>

Then in your xml folder you now have to create a file named network_security_config just like the way you have named it in the Manifest and from there the content of your file should be like this to enable all requests without encryptions:

<?xml version="1.0" encoding="utf-8"?>
<network-security-config>
    <base-config cleartextTrafficPermitted="true">
        <trust-anchors>
            <certificates src="system" />
        </trust-anchors>
    </base-config>
</network-security-config>

source: https://developer.android.com/training/articles/security-config

All 3 comments


Thanks for submitting your issue. Can you take another look at your description and make sure the issue template has been filled in its entirety?

馃憠 Click here if you want to take another look at the Bug Report issue template.

Android pie (9) doesn't allow non https images to be rendered, so you have to change your http requests to https or to set a networkSecurityConfig in your Manifest application tag like this:

<?xml version="1.0" encoding="utf-8"?>
<manifest ... >
    <application android:networkSecurityConfig="@xml/network_security_config">
    </application>
</manifest>

Then in your xml folder you now have to create a file named network_security_config just like the way you have named it in the Manifest and from there the content of your file should be like this to enable all requests without encryptions:

<?xml version="1.0" encoding="utf-8"?>
<network-security-config>
    <base-config cleartextTrafficPermitted="true">
        <trust-anchors>
            <certificates src="system" />
        </trust-anchors>
    </base-config>
</network-security-config>

source: https://developer.android.com/training/articles/security-config

Was this page helpful?
0 / 5 - 0 ratings