build.gradle 4.15 KB
Newer Older
Wietse Kuipers's avatar
Wietse Kuipers committed
1
2
3
4
apply plugin: "com.android.application"

import com.android.build.OutputFile

5
6
7
8
project.ext.react = [
    entryFile: "index.js"
]

Wietse Kuipers's avatar
Wietse Kuipers committed
9
apply from: "../../node_modules/react-native/react.gradle"
10
11
// Disabled because of https://github.com/getsentry/react-native-sentry/issues/326
// apply from: "../../node_modules/react-native-sentry/sentry.gradle"
Wietse Kuipers's avatar
Wietse Kuipers committed
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28

/**
 * Set this to true to create two separate APKs instead of one:
 *   - An APK that only works on ARM devices
 *   - An APK that only works on x86 devices
 * The advantage is the size of the APK is reduced by about 4MB.
 * Upload all the APKs to the Play Store and people will download
 * the correct one based on the CPU architecture of their device.
 */
def enableSeparateBuildPerCPUArchitecture = false

/**
 * Run Proguard to shrink the Java bytecode in release builds.
 */
def enableProguardInReleaseBuilds = false

android {
Sébastiaan Versteeg's avatar
Sébastiaan Versteeg committed
29
    compileSdkVersion rootProject.ext.compileSdkVersion
Wietse Kuipers's avatar
Wietse Kuipers committed
30

31
32
33
    compileOptions {
        sourceCompatibility JavaVersion.VERSION_1_8
        targetCompatibility JavaVersion.VERSION_1_8
Wietse Kuipers's avatar
Wietse Kuipers committed
34
35
    }

Wietse Kuipers's avatar
Wietse Kuipers committed
36
    defaultConfig {
37
        applicationId "com.thaliapp"
Sébastiaan Versteeg's avatar
Sébastiaan Versteeg committed
38
39
        minSdkVersion rootProject.ext.minSdkVersion
        targetSdkVersion rootProject.ext.targetSdkVersion
40
        versionCode 436
Gijs Hendriksen's avatar
Gijs Hendriksen committed
41
        versionName "2.8.1"
Wietse Kuipers's avatar
Wietse Kuipers committed
42
    }
43

Wietse Kuipers's avatar
Wietse Kuipers committed
44
45
46
47
48
    splits {
        abi {
            reset()
            enable enableSeparateBuildPerCPUArchitecture
            universalApk false  // If true, also generate a universal APK
49
            include "armeabi-v7a", "x86", "arm64-v8a", "x86_64"
Wietse Kuipers's avatar
Wietse Kuipers committed
50
51
        }
    }
52

Wietse Kuipers's avatar
Wietse Kuipers committed
53
54
55
56
57
    buildTypes {
        release {
            minifyEnabled enableProguardInReleaseBuilds
            proguardFiles getDefaultProguardFile("proguard-android.txt"), "proguard-rules.pro"
        }
Nienke's avatar
Nienke committed
58
59
60
        debug {
            applicationIdSuffix ".dev"
        }
Wietse Kuipers's avatar
Wietse Kuipers committed
61
    }
62

Wietse Kuipers's avatar
Wietse Kuipers committed
63
64
65
66
67
    // 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:
            // http://tools.android.com/tech-docs/new-build-system/user-guide/apk-splits
68
            def versionCodes = ["armeabi-v7a":1, "x86":2, "arm64-v8a": 3, "x86_64": 4]
Wietse Kuipers's avatar
Wietse Kuipers committed
69
70
71
72
73
74
75
76
77
78
            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 {
79
    implementation project(':react-native-fs')
80
81
    implementation project(':@react-native-community_status-bar')
    implementation project(':@react-native-community_async-storage')
82
    implementation project(':react-native-device-info')
83
    implementation project(':react-native-image-crop-picker')
84
    implementation project(':react-native-screens')
Sébastiaan Versteeg's avatar
Sébastiaan Versteeg committed
85
    implementation project(':react-native-gesture-handler')
86
    implementation project(':react-native-sentry')
Sébastiaan Versteeg's avatar
Sébastiaan Versteeg committed
87
88
89
    implementation project(':react-native-vector-icons')
    implementation project(':react-native-snackbar')
    implementation project(':react-native-linear-gradient')
90
    implementation project(':react-native-firebase')
91
    implementation project(':react-native-share')
Sébastiaan Versteeg's avatar
Sébastiaan Versteeg committed
92
93
94
95
    implementation fileTree(dir: "libs", include: ["*.jar"])
    implementation "com.android.support:appcompat-v7:${rootProject.ext.supportLibVersion}"
    implementation "com.android.support:design:${rootProject.ext.supportLibVersion}"
    implementation "com.facebook.react:react-native:+"  // From node_modules
96
97
    implementation "com.google.firebase:firebase-core:16.0.9"
    implementation "com.google.firebase:firebase-messaging:18.0.0"
Wietse Kuipers's avatar
Wietse Kuipers committed
98
99
100
101
102
103
104
105
}

// 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'
}
106
107
108
109
110
111
112
113

gradle.projectsEvaluated {
    installDebug.doLast {
        println 'Running `adb reverse tcp:8000 tcp:8000`'
        def processBuilder = new ProcessBuilder(['adb', 'reverse', 'tcp:8000', 'tcp:8000'])
        processBuilder.start()
    }
}
114

Wietse Kuipers's avatar
Wietse Kuipers committed
115
apply plugin: 'com.google.gms.google-services'