1- apply plugin : ' com.android.application'
1+ apply plugin : " com.android.application"
2+
3+ import com.android.build.OutputFile
4+
5+ /**
6+ * The react.gradle file registers a task for each build variant (e.g. bundleDebugJsAndAssets
7+ * and bundleReleaseJsAndAssets).
8+ * These basically call `react-native bundle` with the correct arguments during the Android build
9+ * cycle. By default, bundleDebugJsAndAssets is skipped, as in debug/dev mode we prefer to load the
10+ * bundle directly from the development server. Below you can see all the possible configurations
11+ * and their defaults. If you decide to add a configuration block, make sure to add it before the
12+ * `apply from: "react.gradle"` line.
13+ *
14+ * project.ext.react = [
15+ * // the name of the generated asset file containing your JS bundle
16+ * bundleAssetName: "index.android.bundle",
17+ *
18+ * // the entry file for bundle generation
19+ * entryFile: "index.android.js",
20+ *
21+ * // whether to bundle JS and assets in debug mode
22+ * bundleInDebug: false,
23+ *
24+ * // whether to bundle JS and assets in release mode
25+ * bundleInRelease: true,
26+ *
27+ * // whether to bundle JS and assets in another build variant (if configured).
28+ * // See http://tools.android.com/tech-docs/new-build-system/user-guide#TOC-Build-Variants
29+ * // The configuration property is in the format 'bundleIn${productFlavor}${buildType}'
30+ * // bundleInFreeDebug: true,
31+ * // bundleInPaidRelease: true,
32+ * // bundleInBeta: true,
33+ *
34+ * // the root of your project, i.e. where "package.json" lives
35+ * root: "../../",
36+ *
37+ * // where to put the JS bundle asset in debug mode
38+ * jsBundleDirDebug: "$buildDir/intermediates/assets/debug",
39+ *
40+ * // where to put the JS bundle asset in release mode
41+ * jsBundleDirRelease: "$buildDir/intermediates/assets/release",
42+ *
43+ * // where to put drawable resources / React Native assets, e.g. the ones you use via
44+ * // require('./image.png')), in debug mode
45+ * resourcesDirDebug: "$buildDir/intermediates/res/merged/debug",
46+ *
47+ * // where to put drawable resources / React Native assets, e.g. the ones you use via
48+ * // require('./image.png')), in release mode
49+ * resourcesDirRelease: "$buildDir/intermediates/res/merged/release",
50+ *
51+ * // by default the gradle tasks are skipped if none of the JS files or assets change; this means
52+ * // that we don't look at files in android/ or ios/ to determine whether the tasks are up to
53+ * // date; if you have any other folders that you want to ignore for performance reasons (gradle
54+ * // indexes the entire tree), add them here. Alternatively, if you have JS files in android/
55+ * // for example, you might want to remove it from here.
56+ * inputExcludes: ["android/**", "ios/**"]
57+ * ]
58+ */
259
360apply from : " react.gradle"
461
62+ /**
63+ * Set this to true to create three separate APKs instead of one:
64+ * - A universal APK that works on all devices
65+ * - An APK that only works on ARM devices
66+ * - An APK that only works on x86 devices
67+ * The advantage is the size of the APK is reduced by about 4MB.
68+ * Upload all the APKs to the Play Store and people will download
69+ * the correct one based on the CPU architecture of their device.
70+ */
71+ def enableSeparateBuildPerCPUArchitecture = false
72+
73+ /**
74+ * Run Proguard to shrink the Java bytecode in release builds.
75+ */
76+ def enableProguardInReleaseBuilds = true
77+
578android {
679 compileSdkVersion 23
780 buildToolsVersion " 23.0.1"
@@ -16,17 +89,38 @@ android {
1689 abiFilters " armeabi-v7a" , " x86"
1790 }
1891 }
92+ splits {
93+ abi {
94+ enable enableSeparateBuildPerCPUArchitecture
95+ universalApk true
96+ reset()
97+ include " armeabi-v7a" , " x86"
98+ }
99+ }
19100 buildTypes {
20101 release {
21- minifyEnabled false
22- proguardFiles getDefaultProguardFile(' proguard-android.txt' ), ' proguard-rules.pro'
102+ minifyEnabled enableProguardInReleaseBuilds
103+ proguardFiles getDefaultProguardFile(" proguard-android.txt" ), " proguard-rules.pro"
104+ }
105+ }
106+ // applicationVariants are e.g. debug, release
107+ applicationVariants. all { variant ->
108+ variant. outputs. each { output ->
109+ // For each separate APK per architecture, set a unique version code as described here:
110+ // http://tools.android.com/tech-docs/new-build-system/user-guide/apk-splits
111+ def versionCodes = [" armeabi-v7a" :1 , " x86" :2 ]
112+ def abi = output. getFilter(OutputFile . ABI )
113+ if (abi != null ) { // null for the universal-debug, universal-release variants
114+ output. versionCodeOverride =
115+ versionCodes. get(abi) * 1048576 + defaultConfig. versionCode
116+ }
23117 }
24118 }
25119}
26120
27121dependencies {
28- compile fileTree(dir : ' libs' , include : [' *.jar' ])
29- compile ' com.android.support:appcompat-v7:23.0.0 '
30- compile ' com.facebook.react:react-native:0.15.1 '
31- compile project(' :react-native-code-push' )
122+ compile fileTree(dir : " libs" , include : [" *.jar" ])
123+ compile " com.android.support:appcompat-v7:23.0.1 "
124+ compile " com.facebook.react:react-native:0.19.+ "
125+ compile project(" :react-native-code-push" )
32126}
0 commit comments