Skip to content

Commit

Permalink
misc: Add easy enabled splits and flavors in RN Android samples (#4157)
Browse files Browse the repository at this point in the history
  • Loading branch information
krystofwoldrich authored Oct 8, 2024
1 parent ba46d3f commit 46b60ab
Show file tree
Hide file tree
Showing 2 changed files with 35 additions and 1 deletion.
33 changes: 33 additions & 0 deletions samples/react-native/android/app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -146,6 +146,39 @@ android {
keyPassword 'android'
}
}

if (System.getenv('SENTRY_SAMPLE_ENABLE_ABI_SPLIT') == 'true') {
splits {
abi {
enable true
reset()
include 'x86', 'arm64-v8a'
universalApk true
}
}
project.ext.versionCodes = ['armeabi': 1, 'armeabi-v7a': 2, 'arm64-v8a': 3, 'mips': 5, 'mips64': 6, 'x86': 8, 'x86_64': 9]
android.applicationVariants.all { variant ->
variant.outputs.each { output ->
output.versionCodeOverride =
project.ext.versionCodes.get(output.getFilter(
com.android.build.OutputFile.ABI), 0) * 10000000 + android.defaultConfig.versionCode
}
}
}

if (System.getenv('SENTRY_SAMPLE_ENABLE_FLAVORS') == 'true') {
flavorDimensions "version"
productFlavors {
regular {
dimension "version"
}
demo {
dimension "version"
applicationIdSuffix "demo"
}
}
}

buildTypes {
debug {
signingConfig signingConfigs.debug
Expand Down
3 changes: 2 additions & 1 deletion samples/react-native/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,8 @@
"clean-watchman": "watchman watch-del-all",
"set-build-number": "npx react-native-version --skip-tag --never-amend --set-build",
"set-version": "npm version --no-git-tag-version",
"postversion": "npx react-native-version --skip-tag --never-amend"
"postversion": "npx react-native-version --skip-tag --never-amend",
"build-android-release-splits-flavors": "export SENTRY_SAMPLE_ENABLE_ABI_SPLIT=true; export SENTRY_SAMPLE_ENABLE_FLAVORS=true; cd android; ./gradlew assembleRelease; cd .."
},
"dependencies": {
"@react-navigation/bottom-tabs": "^6.5.12",
Expand Down

0 comments on commit 46b60ab

Please sign in to comment.