Skip to content

Instantly share code, notes, and snippets.

@wilsolutions
Last active June 22, 2021 19:43
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save wilsolutions/40203ba06050bba39c7833e631917496 to your computer and use it in GitHub Desktop.
Save wilsolutions/40203ba06050bba39c7833e631917496 to your computer and use it in GitHub Desktop.
#
# app/build.gradle
#
apply plugin: "com.android.application"
apply plugin: 'io.fabric'
import com.android.build.OutputFile
project.ext.react = [
entryFile: "index.js",
enableHermes: false, // clean and rebuild if changing
]
apply from: "../../node_modules/react-native/react.gradle"
apply from: "../../node_modules/newrelic-mobile-rn/newrelic.gradle"
def enableSeparateBuildPerCPUArchitecture = false
def enableProguardInReleaseBuilds = false
def jscFlavor = 'org.webkit:android-jsc:+'
def enableHermes = project.ext.react.get("enableHermes", false);
android {
compileSdkVersion rootProject.ext.compileSdkVersion
dexOptions {
preDexLibraries false
javaMaxHeapSize "4g"
}
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
defaultConfig {
applicationId "com.mercatustechnologies.mercatus"
minSdkVersion rootProject.ext.minSdkVersion
targetSdkVersion rootProject.ext.targetSdkVersion
versionCode 1
versionName "1.0"
}
splits {
abi {
reset()
enable enableSeparateBuildPerCPUArchitecture
universalApk false // If true, also generate a universal APK
include "armeabi-v7a", "x86", "arm64-v8a", "x86_64"
}
}
signingConfigs {
debug {
storeFile file('debug.keystore')
storePassword 'android'
keyAlias 'androiddebugkey'
keyPassword 'android'
}
}
buildTypes {
debug {
signingConfig signingConfigs.debug
}
release {
// Caution! In production, you need to generate your own keystore file.
// see https://facebook.github.io/react-native/docs/signed-apk-android.
signingConfig signingConfigs.debug
minifyEnabled enableProguardInReleaseBuilds
proguardFiles getDefaultProguardFile("proguard-android.txt"), "proguard-rules.pro"
}
}
// applicationVariants are e.g. debug, release
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
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 =
versionCodes.get(abi) * 1048576 + defaultConfig.versionCode
}
}
}
}
dependencies {
implementation fileTree(dir: "libs", include: ["*.jar"])
implementation "com.facebook.react:react-native:+" // From node_modules
implementation 'androidx.appcompat:appcompat:1.1.0-rc01'
implementation 'androidx.swiperefreshlayout:swiperefreshlayout:1.1.0-alpha02'
if (enableHermes) {
def hermesPath = "../../node_modules/hermes-engine/android/";
debugImplementation files(hermesPath + "hermes-debug.aar")
releaseImplementation files(hermesPath + "hermes-release.aar")
} else {
implementation jscFlavor
}
}
// Run this once to be able to run the application with BUCK
// puts all compile dependencies into folder libs for BUCK to use
task copyDownloadableDepsToLibs(type: Copy) {
from configurations.compile
into 'libs'
}
apply plugin: 'com.google.gms.google-services'
apply from: file("../../node_modules/@react-native-community/cli-platform-android/native_modules.gradle"); applyNativeModulesAppBuildGradle(project)
#
# package.json
#
{
"name": "AppDemo",
"version": "0.0.1",
"private": true,
"scripts": {
"android": "react-native run-android",
"ios": "react-native run-ios",
"start": "react-native start --reset-cache",
},
"dependencies": {
"@datanerd/newrelic-mobile-cli": "./newrelic-2020-1-8/newrelic-mobile-cli-0.2.0.tgz",
"@react-native-community/masked-view": "^0.1.6",
"@react-native-firebase/analytics": "^6.3.2",
"@react-native-firebase/app": "^6.3.2",
"@react-native-firebase/crashlytics": "^6.3.3",
"@react-navigation/bottom-tabs": "^5.0.0",
"@react-navigation/drawer": "^5.0.0",
"@react-navigation/native": "^5.0.0",
"@react-navigation/routers": "^5.0.0",
"@react-navigation/stack": "^5.0.0",
"axios": "0.19.2",
"axios-observable": "^1.1.2",
"babel-plugin-module-resolver": "^4.0.0",
"i18n-js": "^3.5.1",
"json5": "^2.1.1",
"lodash": "^4.17.15",
"newrelic-mobile-rn": "./newrelic-2020-1-8/newrelic-mobile-rn-0.0.63.tgz",
"react": "16.12.0",
"react-native": "0.61.5",
"react-native-gesture-handler": "^1.5.6",
"react-native-local-resource": "^0.1.6",
"react-native-localize": "^1.3.3",
"react-native-reanimated": "^1.7.0",
"react-native-safe-area-context": "^0.7.2",
"react-native-screens": "^2.0.0-beta.2",
"react-native-vector-icons": "^6.6.0",
"react-native-webview": "^8.0.5",
"react-redux": "^7.1.3",
"redux": "^4.0.5",
"redux-observable": "^1.2.0",
"reselect": "^4.0.0",
"rxjs": "^6.5.4",
"ts-transformer-keys": "^0.4.1",
"urbanairship-react-native": "^6.0.1"
},
"devDependencies": {
"@babel/core": "^7.6.2",
"@babel/runtime": "^7.6.2",
"@react-native-community/eslint-config": "^0.0.7",
"@types/command-line-args": "^5.0.0",
"@types/jest": "^25.1.2",
"@types/json5": "^0.0.30",
"@types/lodash": "^4.14.149",
"@types/react-native": "^0.61.10",
"@types/react-native-fbsdk": "^1.0.0",
"@types/react-native-vector-icons": "^6.4.5",
"@types/react-redux": "^7.1.5",
"@types/react-test-renderer": "16.9.2",
"@types/redux": "^3.6.0",
"babel-jest": "^25.1.0",
"command-line-args": "^5.1.1",
"jest": "^25.1.0",
"jetifier": "^1.6.5",
"json-schema-to-typescript": "^8.0.1",
"metro-react-native-babel-preset": "^0.58.0",
"react-test-renderer": "16.12.0",
"simple-http-file-server": "^1.0.1",
"ssl-root-cas": "^1.3.1",
"typescript": "^3.7.4"
},
"jest": {
"preset": "react-native",
"testRegex": "(/__tests__/.*(test|spec)\\.[jt]sx?$|(\\.|/)(test|spec))\\.[jt]sx?$",
"moduleFileExtensions": [
"ts",
"tsx",
"js",
"jsx",
"json",
"node"
]
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment