Skip to content
This repository was archived by the owner on Dec 16, 2025. It is now read-only.
This repository was archived by the owner on Dec 16, 2025. It is now read-only.

usesCleartextTraffic, Enable react-native-debugger and npm start (Metro server) to work post API 27 #74

@sanjarcode

Description

@sanjarcode

To enable usesCleartextTraffic=true only for non-release environments, you can use a Gradle-based approach with manifest placeholders. Here's how to do it:

  1. Define a placeholder in AndroidManifest.xml:

    In your AndroidManifest.xml, update the usesCleartextTraffic attribute with a placeholder:

    <application
        android:usesCleartextTraffic="${usesCleartextTraffic}">
    </application>
  2. Configure the placeholder in build.gradle:

    In your app/build.gradle, you can specify the placeholder value based on the build type (e.g., debug or release):

    android {
        ...
        buildTypes {
            debug {
                manifestPlaceholders = [usesCleartextTraffic: true] // Enable cleartext traffic for debug
            }
            release {
                manifestPlaceholders = [usesCleartextTraffic: false] // Disable cleartext traffic for release
            }
        }
    }

This will set usesCleartextTraffic to true for non-release builds like debug and false for release builds. You can adjust the values based on the environments you want.

By default npm start + npm run android runs in debug mode.

  • ios is unaffected, since it has always been HTTPS.

Without this the debug tool and Metro server, neither work. Like first upload is done and r key has no effect in Metro

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions