lugg / react-native-config

Bring some 12 factor love to your mobile apps!
MIT License
4.76k stars 652 forks source link

output.versionCodeOverride is not getting override when version code is coming from .env #776

Open NehalBubere123 opened 8 months ago

NehalBubere123 commented 8 months ago

defaultConfig { minSdkVersion rootProject.ext.minSdkVersion targetSdkVersion rootProject.ext.targetSdkVersion versionCode project.env.get("VERSION_CODE").toInteger() versionName project.env.get("VERSION_NAME") vectorDrawables.useSupportLibrary = true buildConfigField "boolean", "IS_NEW_ARCHITECTURE_ENABLED", isNewArchitectureEnabled().toString() }

applicationVariants.all { variant -> variant.outputs.each { output -> // For each separate APK per architecture, set a unique version code as described here: // https://developer.android.com/studio/build/configure-apk-splits.html // Example: versionCode 1 will generate 1001 for armeabi-v7a, 1002 for x86, etc. def versionCodes = ["armeabi-v7a": 1, "x86": 2, "arm64-v8a": 3, "x86_64": 4] def abi = output.getFilter(OutputFile.ABI) if (abi != null) { // null for the universal-debug, universal-release variants output.versionCodeOverride = defaultConfig.versionCode * 1000 + versionCodes.get(abi) }

    }
}