From 84572c4051f11f68ddf0928d2c3df5850ae15491 Mon Sep 17 00:00:00 2001 From: Salakar Date: Fri, 1 Feb 2019 06:33:04 -0800 Subject: [PATCH] apply Network Security Config file (fixes #22375) (part 2 of #23105) (#23135) Summary: This is a follow-up PR for https://github.com/facebook/react-native/pull/23105 - as mentioned on discord. --- This PR applies the network security config for the RN template project only. New RN projects started with the updated template will be able to connect to the packager on builds built with Android API 28 & above. See https://developer.android.com/training/articles/security-config#CleartextTrafficPermitted for more information about this newly required config, specifically: ![image](https://user-images.githubusercontent.com/5347038/52124287-b3de2580-2620-11e9-958d-bc2da15c6f01.png) Changelog: ---------- [ANDROID] [Template] add Network Security Config file to allow access to packager via cleartext requests in Android API 28 and above. (fixes #22375) Pull Request resolved: https://github.com/facebook/react-native/pull/23135 Differential Revision: D13917058 Pulled By: cpojer fbshipit-source-id: 0e66f2cde712c1285d217e3625b73028c3770b65 --- .../app/src/debug/res}/xml/network_security_config.xml | 0 template/android/app/src/main/AndroidManifest.xml | 7 +++++-- .../app/src/release/res/xml/network_security_config.xml | 8 ++++++++ 3 files changed, 13 insertions(+), 2 deletions(-) rename {ReactAndroid/src/main/res/devsupport => template/android/app/src/debug/res}/xml/network_security_config.xml (100%) create mode 100644 template/android/app/src/release/res/xml/network_security_config.xml diff --git a/ReactAndroid/src/main/res/devsupport/xml/network_security_config.xml b/template/android/app/src/debug/res/xml/network_security_config.xml similarity index 100% rename from ReactAndroid/src/main/res/devsupport/xml/network_security_config.xml rename to template/android/app/src/debug/res/xml/network_security_config.xml diff --git a/template/android/app/src/main/AndroidManifest.xml b/template/android/app/src/main/AndroidManifest.xml index a6eda6784a2950..1b0c20ef328804 100644 --- a/template/android/app/src/main/AndroidManifest.xml +++ b/template/android/app/src/main/AndroidManifest.xml @@ -1,5 +1,6 @@ + xmlns:tools="http://schemas.android.com/tools" + package="com.helloworld"> @@ -10,7 +11,9 @@ android:icon="@mipmap/ic_launcher" android:roundIcon="@mipmap/ic_launcher_round" android:allowBackup="false" - android:theme="@style/AppTheme"> + android:theme="@style/AppTheme" + android:networkSecurityConfig="@xml/network_security_config" + tools:ignore="GoogleAppIndexingWarning,UnusedAttribute"> + + + localhost + 10.0.2.2 + 10.0.3.2 + +