Advertisement
Guest User

Untitled

a guest
Feb 13th, 2019
103
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Groovy 3.01 KB | None | 0 0
  1. apply plugin: "com.android.application"
  2.  
  3. import com.android.build.OutputFile
  4.  
  5.  
  6. project.ext.react = [
  7.     entryFile: "index.js"
  8. ]
  9.  
  10. apply from: "../../node_modules/react-native/react.gradle"
  11.  
  12. /**
  13.  * Set this to true to create two separate APKs instead of one:
  14.  *   - An APK that only works on ARM devices
  15.  *   - An APK that only works on x86 devices
  16.  * The advantage is the size of the APK is reduced by about 4MB.
  17.  * Upload all the APKs to the Play Store and people will download
  18.  * the correct one based on the CPU architecture of their device.
  19.  */
  20. def enableSeparateBuildPerCPUArchitecture = false
  21.  
  22. /**
  23.  * Run Proguard to shrink the Java bytecode in release builds.
  24.  */
  25. def enableProguardInReleaseBuilds = false
  26.  
  27. android {
  28.     compileSdkVersion rootProject.ext.compileSdkVersion
  29.     buildToolsVersion rootProject.ext.buildToolsVersion
  30.  
  31.     defaultConfig {
  32.         applicationId "com.jptwo"
  33.         minSdkVersion rootProject.ext.minSdkVersion
  34.         targetSdkVersion rootProject.ext.targetSdkVersion
  35.         versionCode 1
  36.         versionName "1.0"
  37.         missingDimensionStrategy "RNN.reactNativeVersion", "reactNative58"
  38.     }
  39.     compileOptions {
  40.         sourceCompatibility JavaVersion.VERSION_1_8
  41.         targetCompatibility JavaVersion.VERSION_1_8
  42.     }
  43.     splits {
  44.         abi {
  45.             reset()
  46.             enable enableSeparateBuildPerCPUArchitecture
  47.             universalApk false  // If true, also generate a universal APK
  48.             include "armeabi-v7a", "x86", "arm64-v8a"
  49.         }
  50.     }
  51.     buildTypes {
  52.         release {
  53.             minifyEnabled enableProguardInReleaseBuilds
  54.             proguardFiles getDefaultProguardFile("proguard-android.txt"), "proguard-rules.pro"
  55.         }
  56.     }
  57.     // applicationVariants are e.g. debug, release
  58.     applicationVariants.all { variant ->
  59.         variant.outputs.each { output ->
  60.             // For each separate APK per architecture, set a unique version code as described here:
  61.             // http://tools.android.com/tech-docs/new-build-system/user-guide/apk-splits
  62.             def versionCodes = ["armeabi-v7a":1, "x86":2, "arm64-v8a": 3]
  63.             def abi = output.getFilter(OutputFile.ABI)
  64.             if (abi != null) {  // null for the universal-debug, universal-release variants
  65.                 output.versionCodeOverride =
  66.                         versionCodes.get(abi) * 1048576 + defaultConfig.versionCode
  67.             }
  68.         }
  69.     }
  70. }
  71.  
  72. dependencies {
  73.     implementation project(':react-native-vector-icons')
  74.     implementation fileTree(dir: "libs", include: ["*.jar"])
  75.     implementation "com.android.support:appcompat-v7:${rootProject.ext.supportLibVersion}"
  76.     implementation "com.facebook.react:react-native:+"  // From node_modules
  77.     implementation project(':react-native-navigation')
  78. }
  79.  
  80. // Run this once to be able to run the application with BUCK
  81. // puts all compile dependencies into folder libs for BUCK to use
  82. task copyDownloadableDepsToLibs(type: Copy) {
  83.     from configurations.compile
  84.     into 'libs'
  85. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement