Advertisement
Guest User

Untitled

a guest
May 19th, 2021
516
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 4.47 KB | None | 0 0
  1. apply plugin: "com.android.application"
  2. apply from: "../../node_modules/react-native-vector-icons/fonts.gradle"
  3.  
  4. import com.android.build.OutputFile
  5.  
  6. project.ext.react = [
  7.     enableHermes: false
  8. ]
  9.  
  10. apply from: '../../node_modules/react-native-unimodules/gradle.groovy'
  11. apply from: "../../node_modules/react-native/react.gradle"
  12. apply from: "../../node_modules/expo-constants/scripts/get-app-config-android.gradle"
  13. apply from: "../../node_modules/expo-updates/scripts/create-manifest-android.gradle"
  14.  
  15. def enableSeparateBuildPerCPUArchitecture = false
  16.  
  17. def enableProguardInReleaseBuilds = false
  18.  
  19. def jscFlavor = 'org.webkit:android-jsc:+'
  20.  
  21. def enableHermes = project.ext.react.get("enableHermes", false);
  22.  
  23. android {
  24.     compileSdkVersion rootProject.ext.compileSdkVersion
  25.  
  26.     dexOptions {
  27.         javaMaxHeapSize "4g"
  28.     }
  29.  
  30.     compileOptions {
  31.         sourceCompatibility JavaVersion.VERSION_1_8
  32.         targetCompatibility JavaVersion.VERSION_1_8
  33.     }
  34.  
  35.     defaultConfig {
  36.         applicationId "redacted"
  37.         minSdkVersion rootProject.ext.minSdkVersion
  38.         targetSdkVersion rootProject.ext.targetSdkVersion
  39.         versionCode 1
  40.         versionName "1.0"
  41.     }
  42.     splits {
  43.         abi {
  44.             reset()
  45.             enable enableSeparateBuildPerCPUArchitecture
  46.             universalApk false  // If true, also generate a universal APK
  47.             include "armeabi-v7a", "x86", "arm64-v8a", "x86_64"
  48.         }
  49.     }
  50.     signingConfigs {
  51.         debug {
  52.             storeFile file('debug.keystore')
  53.             storePassword 'android'
  54.             keyAlias 'androiddebugkey'
  55.             keyPassword 'android'
  56.         }
  57.         release {
  58.             storeFile file('your_key_name.keystore')
  59.             storePassword 'redacted'
  60.             keyAlias 'redacted'
  61.             keyPassword 'redacted'
  62.         }
  63.     }
  64.     buildTypes {
  65.         debug {
  66.             signingConfig signingConfigs.debug
  67.         }
  68.         release {
  69.             // Caution! In production, you need to generate your own keystore file.
  70.             // see https://reactnative.dev/docs/signed-apk-android.
  71.             signingConfig signingConfigs.release
  72.             minifyEnabled enableProguardInReleaseBuilds
  73.             proguardFiles getDefaultProguardFile("proguard-android.txt"), "proguard-rules.pro"
  74.         }
  75.     }
  76.  
  77.     // applicationVariants are e.g. debug, release
  78.     applicationVariants.all { variant ->
  79.         variant.outputs.each { output ->
  80.             // For each separate APK per architecture, set a unique version code as described here:
  81.             // https://developer.android.com/studio/build/configure-apk-splits.html
  82.             def versionCodes = ["armeabi-v7a": 1, "x86": 2, "arm64-v8a": 3, "x86_64": 4]
  83.             def abi = output.getFilter(OutputFile.ABI)
  84.             if (abi != null) {  // null for the universal-debug, universal-release variants
  85.                 output.versionCodeOverride =
  86.                         versionCodes.get(abi) * 1048576 + defaultConfig.versionCode
  87.             }
  88.  
  89.         }
  90.     }
  91. }
  92.  
  93. dependencies {
  94.     implementation fileTree(dir: "libs", include: ["*.jar"])
  95.     //noinspection GradleDynamicVersion
  96.     implementation "com.facebook.react:react-native:+"  // From node_modules
  97.     implementation "androidx.swiperefreshlayout:swiperefreshlayout:1.0.0"
  98.     debugImplementation("com.facebook.flipper:flipper:${FLIPPER_VERSION}") {
  99.       exclude group:'com.facebook.fbjni'
  100.     }
  101.     debugImplementation("com.facebook.flipper:flipper-network-plugin:${FLIPPER_VERSION}") {
  102.         exclude group:'com.facebook.flipper'
  103.         exclude group:'com.squareup.okhttp3', module:'okhttp'
  104.     }
  105.     debugImplementation("com.facebook.flipper:flipper-fresco-plugin:${FLIPPER_VERSION}") {
  106.         exclude group:'com.facebook.flipper'
  107.     }
  108.     addUnimodulesDependencies()
  109.  
  110.     if (enableHermes) {
  111.         def hermesPath = "../../node_modules/hermes-engine/android/";
  112.         debugImplementation files(hermesPath + "hermes-debug.aar")
  113.         releaseImplementation files(hermesPath + "hermes-release.aar")
  114.     } else {
  115.         implementation jscFlavor
  116.     }
  117. }
  118.  
  119. // Run this once to be able to run the application with BUCK
  120. // puts all compile dependencies into folder libs for BUCK to use
  121. task copyDownloadableDepsToLibs(type: Copy) {
  122.     from configurations.compile
  123.     into 'libs'
  124. }
  125.  
  126. apply from: file("../../node_modules/@react-native-community/cli-platform-android/native_modules.gradle"); applyNativeModulesAppBuildGradle(project)
  127.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement