Skip to content

Commit d5e7f8a

Browse files
authored
disallow cleartext traffic for release builds (allow only for debug) (#1147)
1 parent 13e98ff commit d5e7f8a

File tree

2 files changed

+4
-1
lines changed

2 files changed

+4
-1
lines changed

app/build.gradle.kts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,11 +48,13 @@ android {
4848
debug {
4949
applicationIdSuffix = ".debug"
5050
resValue("string", "application_name", "Droid-ify-Debug")
51+
resValue("string", "cleartext_allowed", "true")
5152
}
5253
release {
5354
isMinifyEnabled = true
5455
isShrinkResources = true
5556
resValue("string", "application_name", "Droid-ify")
57+
resValue("string", "cleartext_allowed", "false")
5658
proguardFiles(
5759
getDefaultProguardFile("proguard-android-optimize.txt"),
5860
"proguard.pro",
@@ -62,6 +64,7 @@ android {
6264
initWith(getByName("debug"))
6365
applicationIdSuffix = ".alpha"
6466
resValue("string", "application_name", "Droid-ify Alpha")
67+
resValue("string", "cleartext_allowed", "false")
6568
proguardFiles(
6669
getDefaultProguardFile("proguard-android-optimize.txt"),
6770
"proguard.pro",

app/src/main/res/xml/network_security_config.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<?xml version="1.0" encoding="utf-8"?>
22

33
<network-security-config>
4-
<base-config cleartextTrafficPermitted="true">
4+
<base-config cleartextTrafficPermitted="@string/cleartext_allowed">
55
<trust-anchors>
66
<!-- Trust preinstalled CAs -->
77
<certificates src="system" />

0 commit comments

Comments
 (0)