1- apply plugin : " com.android.application"
1+ // this includes the onesignal gradle plugin
2+ apply plugin : ' com.onesignal.androidsdk.onesignal-gradle-plugin'
3+ // this plugin adapts the gradle build for android apps
4+ apply plugin : ' com.android.application'
25
36/**
47 * The react.gradle file registers a task for each build variant (e.g. bundleDebugJsAndAssets
@@ -94,18 +97,19 @@ def enableSeparateBuildPerCPUArchitecture = false
9497 */
9598def enableProguardInReleaseBuilds = false
9699
97- def COMPILE_SDK_VERSION = 28
98- def TARGET_SDK_VERSION = 28
99- def ANDROID_SUPPORT_LIBRARY_VERSION = ' 27.1.1'
100-
101100android {
102- compileSdkVersion COMPILE_SDK_VERSION
101+ compileSdkVersion rootProject. ext. compileSdkVersion
102+
103+ compileOptions {
104+ sourceCompatibility JavaVersion . VERSION_1_8
105+ targetCompatibility JavaVersion . VERSION_1_8
106+ }
103107
104108 defaultConfig {
105109 applicationId " com.allaboutolaf"
106110
107- minSdkVersion 21
108- targetSdkVersion TARGET_SDK_VERSION
111+ minSdkVersion rootProject . ext . minSdkVersion
112+ targetSdkVersion rootProject . ext . targetSdkVersion
109113
110114 versionCode 1
111115 versionName " 1.0.0"
@@ -115,16 +119,6 @@ android {
115119 BUGSNAG_KEY : System . getenv(" BUGSNAG_KEY" ) ?: " " ,
116120 onesignal_google_project_number : " REMOTE" ,
117121 ]
118-
119- ndk {
120- abiFilters " armeabi-v7a" , " x86"
121- }
122- }
123-
124- ext {
125- compileSdkVersion = COMPILE_SDK_VERSION
126- targetSdkVersion = TARGET_SDK_VERSION
127- androidSupportLibraryVersion = ANDROID_SUPPORT_LIBRARY_VERSION
128122 }
129123
130124 signingConfigs {
@@ -137,7 +131,7 @@ android {
137131 reset()
138132 enable enableSeparateBuildPerCPUArchitecture
139133 universalApk false // If true, also generate a universal APK
140- include " armeabi-v7a" , " x86"
134+ include " armeabi-v7a" , " x86" , " arm64-v8a " , " x86_64 "
141135 }
142136 }
143137
@@ -163,7 +157,7 @@ android {
163157
164158 // For each separate APK per architecture, set a unique version code as described here:
165159 // http://tools.android.com/tech-docs/new-build-system/user-guide/apk-splits
166- // def versionCodes = ["armeabi-v7a":1, "x86":2, nil:2]
160+ // def versionCodes = ["armeabi-v7a":1, "x86":2, nil:2, "arm64-v8a": 3, "x86_64": 4 ]
167161
168162 // `abi` is null for the universal-debug, universal-release variants
169163 // def abi = output.getFilter(OutputFile.ABI)
@@ -183,10 +177,10 @@ android {
183177 }
184178
185179 configurations. all {
186- resolutionStrategy. force " com.android.support:appcompat-v7:$A NDROID_SUPPORT_LIBRARY_VERSION "
187- resolutionStrategy. force " com.android.support:customtabs:$A NDROID_SUPPORT_LIBRARY_VERSION "
188- resolutionStrategy. force " com.android.support:support-media-compat:$A NDROID_SUPPORT_LIBRARY_VERSION "
189- resolutionStrategy. force " com.android.support:support-v4:$A NDROID_SUPPORT_LIBRARY_VERSION "
180+ resolutionStrategy. force " com.android.support:appcompat-v7:${ rootProject.ext.supportLibVersion } "
181+ resolutionStrategy. force " com.android.support:customtabs:${ rootProject.ext.supportLibVersion } "
182+ resolutionStrategy. force " com.android.support:support-media-compat:${ rootProject.ext.supportLibVersion } "
183+ resolutionStrategy. force " com.android.support:support-v4:${ rootProject.ext.supportLibVersion } "
190184
191185 resolutionStrategy. force ' org.webkit:android-jsc:r236355'
192186 }
@@ -197,12 +191,13 @@ def propFile = new File('android/app/signing.properties')
197191if (propFile. canRead()) {
198192 Properties props = new Properties ()
199193 props. load(new FileInputStream (propFile))
200- if (props != null
201- && props. containsKey(' STORE_FILE' )
202- && props. containsKey(' STORE_PASSWORD' )
203- && props. containsKey(' KEY_ALIAS' )
204- && props. containsKey(' KEY_PASSWORD' )
205- ) {
194+
195+ bool hasFile = props != null && props. containsKey(' STORE_FILE' );
196+ bool hasPassword = props != null && props. containsKey(' STORE_PASSWORD' );
197+ bool hasAlias = props != null && props. containsKey(' KEY_ALIAS' );
198+ bool hasKeyPass = props != null && props. containsKey(' KEY_PASSWORD' );
199+
200+ if (hasFile && hasPassword && hasAlias && hasKeyPass) {
206201 logger. info ' android/app/signing.properties is fully functional.'
207202 android. signingConfigs. release. storeFile = file(props[' STORE_FILE' ])
208203 android. signingConfigs. release. storePassword = props[' STORE_PASSWORD' ]
@@ -213,10 +208,10 @@ if (propFile.canRead()) {
213208 if (props == null ) {
214209 logger. warn ' `props` was null'
215210 } else {
216- logger. warn " has STORE_FILE: ${ props.containsKey('STORE_FILE')} "
217- logger. warn " has STORE_PASSWORD: ${ props.containsKey('STORE_PASSWORD')} "
218- logger. warn " has KEY_ALIAS: ${ props.containsKey('KEY_ALIAS')} "
219- logger. warn " has KEY_PASSWORD: ${ props.containsKey('KEY_PASSWORD')} "
211+ logger. warn " has STORE_FILE [y/n] : ${ props.containsKey('STORE_FILE')} "
212+ logger. warn " has STORE_PASSWORD [y/n] : ${ props.containsKey('STORE_PASSWORD')} "
213+ logger. warn " has KEY_ALIAS [y/n] : ${ props.containsKey('KEY_ALIAS')} "
214+ logger. warn " has KEY_PASSWORD [y/n] : ${ props.containsKey('KEY_PASSWORD')} "
220215 }
221216 android. buildTypes. release. signingConfig = null
222217 }
@@ -240,20 +235,15 @@ dependencies {
240235 implementation project(' :react-native-onesignal' )
241236 implementation project(' :react-native-restart' )
242237 implementation project(' :react-native-vector-icons' )
238+
243239 // this is for react-native itself
244240 implementation fileTree(dir : " libs" , include : [" *.jar" ])
245- implementation " com.android.support:appcompat-v7:$ANDROID_SUPPORT_LIBRARY_VERSION "
241+ implementation " com.android.support:appcompat-v7:${ rootProject.ext.supportLibVersion} "
242+
246243 // noinspection GradleDynamicVersion
247244 implementation " com.facebook.react:react-native:+" // From node_modules
248245}
249246
250- // Run this once to be able to run the application with BUCK
251- // puts all compile dependencies into folder libs for BUCK to use
252- task copyDownloadableDepsToLibs (type : Copy ) {
253- from configurations. compile
254- into ' libs'
255- }
256-
257247// Bundles the app's data for the build process
258248task bundleData (type : Exec ) {
259249 workingDir ' ../../'
@@ -262,6 +252,10 @@ task bundleData(type: Exec) {
262252
263253gradle. projectsEvaluated {
264254 // hook bundleData into the android build process
265- bundleDebugJsAndAssets. dependsOn bundleData
266- bundleReleaseJsAndAssets. dependsOn bundleData
255+ if (project. hasProperty(' bundleDebugJsAndAssets' )) {
256+ bundleDebugJsAndAssets. dependsOn bundleData
257+ }
258+ if (project. hasProperty(' bundleReleaseJsAndAssets' )) {
259+ bundleReleaseJsAndAssets. dependsOn bundleData
260+ }
267261}
0 commit comments