1

Hi I cannot found any answer solution for this

I have follwoing custom variant in \android\app\build.gradle

I have tried put debuggable false

But this does not changed __DEV__ to false.

Everyone is telling debug variant and release variant but nobody is telling how exactly a specific toggle to change __DEV__ to false.

Please help thanks.

buildTypes {

        alpha {
            signingConfig signingConfigs.dev

            debuggable false 
            
            ...
            proguardFiles getDefaultProguardFile("proguard-android.txt"), "proguard-rules.pro"

            matchingFallbacks = ['release', 'debug']
        }
    }

also I have tried removed 'debug' from matchingFallbacks not working as well.


            matchingFallbacks = ['release']
elliotching
  • 972
  • 1
  • 10
  • 33

2 Answers2

0

If im not mistaking you are looking at it wrong. As the link below mentions.

You can use the DEV global variable in JavaScript to determine if you're using React Native packager or not. If you are running your app in the iOS Simulator or Android emulator DEV will be set to true.

React Native DEV and PROD variables

As long as your running the app on emulators the __DEV__ variable will be true.

You can try to run in a simulator with --configuration Release

Obsidianlab
  • 667
  • 1
  • 4
  • 24
0

I'm experiencing this problem too, in my case the buildType name should contain "release" keyword. (don't ask me why)

Change alpha to alphaRelease and everything should works fine.

Example:

(I'm using RN 0.68.2)

    buildTypes {
        debug {
            signingConfig signingConfigs.debug
            debuggable true
            applicationIdSuffix ".dev"
        }
        alphaRelease {
            initWith release
            matchingFallbacks = ['release']

            signingConfig signingConfigs.hmg
            debuggable false
            applicationIdSuffix ".hmg"
        }
        release {
            /* Add the firebaseCrashlytics extension (by default, it's disabled to improve build speeds) and set
            * nativeSymbolUploadEnabled to true along with a pointer to native libs. */
            firebaseCrashlytics {
                nativeSymbolUploadEnabled true
                unstrippedNativeLibsDir 'build/intermediates/merged_native_libs/release/out/lib'
            }

            // Caution! In production, you need to generate your own keystore file.
            // see https://reactnative.dev/docs/signed-apk-android.
            signingConfig signingConfigs.release
            minifyEnabled enableProguardInReleaseBuilds
            proguardFiles getDefaultProguardFile("proguard-android.txt"), "proguard-rules.pro"
            debuggable false
            applicationIdSuffix ""
        }
    }