Skip to content

Commit 84572c4

Browse files
Salakarfacebook-github-bot
authored andcommitted
apply Network Security Config file (fixes #22375) (part 2 of #23105) (#23135)
Summary: This is a follow-up PR for #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: #23135 Differential Revision: D13917058 Pulled By: cpojer fbshipit-source-id: 0e66f2cde712c1285d217e3625b73028c3770b65
1 parent 32cb9ec commit 84572c4

File tree

3 files changed

+13
-2
lines changed

3 files changed

+13
-2
lines changed

template/android/app/src/main/AndroidManifest.xml

+5-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
2-
package="com.helloworld">
2+
xmlns:tools="http://schemas.android.com/tools"
3+
package="com.helloworld">
34

45
<uses-permission android:name="android.permission.INTERNET" />
56
<uses-permission android:name="android.permission.SYSTEM_ALERT_WINDOW"/>
@@ -10,7 +11,9 @@
1011
android:icon="@mipmap/ic_launcher"
1112
android:roundIcon="@mipmap/ic_launcher_round"
1213
android:allowBackup="false"
13-
android:theme="@style/AppTheme">
14+
android:theme="@style/AppTheme"
15+
android:networkSecurityConfig="@xml/network_security_config"
16+
tools:ignore="GoogleAppIndexingWarning,UnusedAttribute">
1417
<activity
1518
android:name=".MainActivity"
1619
android:label="@string/app_name"
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<network-security-config>
3+
<domain-config cleartextTrafficPermitted="false">
4+
<domain includeSubdomains="false">localhost</domain>
5+
<domain includeSubdomains="false">10.0.2.2</domain>
6+
<domain includeSubdomains="false">10.0.3.2</domain>
7+
</domain-config>
8+
</network-security-config>

0 commit comments

Comments
 (0)