From 5747094532bace3fe6b1ebdf55235e53189baa71 Mon Sep 17 00:00:00 2001 From: Dulmandakh Date: Wed, 13 Feb 2019 06:31:00 -0800 Subject: [PATCH] improve Android Network Security config (#23429) Summary: This PR is trying to improve Android Network Security configuration introduced in https://github.com/facebook/react-native/commit/84572c4051f11f68ddf0928d2c3df5850ae15491. I found that Android merges all manifest files into a single manifest file when building an app, so this PR provides AndroidManifest.xml with network security config in debug folder, that will be used only for debug builds. Also the network security configuration will be applied to only app that target API 28. Moved security config file to xml-v28, so that it'll only visible to API 28 and above. See https://developer.android.com/studio/build/manifest-merge [Android] [Changed] - Android Network Security configuration. Pull Request resolved: https://github.com/facebook/react-native/pull/23429 Differential Revision: D14065124 Pulled By: cpojer fbshipit-source-id: 0f5ac5addbe968ed7e5cb57f356e2572de2690a8 --- template/android/app/src/debug/AndroidManifest.xml | 5 +++++ .../react_native_config.xml} | 0 template/android/app/src/main/AndroidManifest.xml | 5 +---- .../app/src/release/res/xml/network_security_config.xml | 8 -------- 4 files changed, 6 insertions(+), 12 deletions(-) create mode 100644 template/android/app/src/debug/AndroidManifest.xml rename template/android/app/src/debug/res/{xml/network_security_config.xml => xml-v28/react_native_config.xml} (100%) delete mode 100644 template/android/app/src/release/res/xml/network_security_config.xml diff --git a/template/android/app/src/debug/AndroidManifest.xml b/template/android/app/src/debug/AndroidManifest.xml new file mode 100644 index 00000000000000..1fce564881ff37 --- /dev/null +++ b/template/android/app/src/debug/AndroidManifest.xml @@ -0,0 +1,5 @@ + + + + \ No newline at end of file diff --git a/template/android/app/src/debug/res/xml/network_security_config.xml b/template/android/app/src/debug/res/xml-v28/react_native_config.xml similarity index 100% rename from template/android/app/src/debug/res/xml/network_security_config.xml rename to template/android/app/src/debug/res/xml-v28/react_native_config.xml diff --git a/template/android/app/src/main/AndroidManifest.xml b/template/android/app/src/main/AndroidManifest.xml index 1b0c20ef328804..e5e6330fbdf64d 100644 --- a/template/android/app/src/main/AndroidManifest.xml +++ b/template/android/app/src/main/AndroidManifest.xml @@ -1,5 +1,4 @@ @@ -11,9 +10,7 @@ android:icon="@mipmap/ic_launcher" android:roundIcon="@mipmap/ic_launcher_round" android:allowBackup="false" - android:theme="@style/AppTheme" - android:networkSecurityConfig="@xml/network_security_config" - tools:ignore="GoogleAppIndexingWarning,UnusedAttribute"> + android:theme="@style/AppTheme"> - - - localhost - 10.0.2.2 - 10.0.3.2 - -