xref: /expo/android/build.gradle (revision bb8f4f99)
1// Top-level build file where you can add configuration options common to all sub-projects/modules.
2
3buildscript {
4  ext {
5    minSdkVersion = 21
6    targetSdkVersion = 30
7    compileSdkVersion = 30
8
9    dbFlowVersion = '4.2.4'
10    buildToolsVersion = '30.0.5'
11    supportLibVersion = '29.0.0'
12    kotlinVersion = '1.4.21'
13    gradlePluginVersion = '4.1.2'
14    gradleDownloadTaskVersion = '3.4.3'
15    repositoryUrl = "file:${System.env.HOME}/.m2/repository/"
16  }
17  repositories {
18    google()
19    jcenter()
20    maven { url 'https://dl.bintray.com/android/android-tools/' }
21  }
22  dependencies {
23    classpath "com.android.tools.build:gradle:${gradlePluginVersion}"
24    classpath 'com.google.gms:google-services:3.2.1'
25    classpath "de.undercouch:gradle-download-task:$gradleDownloadTaskVersion"
26
27    // https://github.com/awslabs/aws-device-farm-gradle-plugin/releases
28    classpath 'com.amazonaws:aws-devicefarm-gradle-plugin:1.3'
29
30    classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlinVersion"
31  }
32}
33
34allprojects {
35  repositories {
36    // For non-detach
37    maven {
38      url "$rootDir/maven"
39    }
40    // For old expoviews to work
41    maven {
42      url "$rootDir/versioned-abis/expoview-abi41_0_0/maven"
43    }
44    maven {
45      url "$rootDir/versioned-abis/expoview-abi40_0_0/maven"
46    }
47    maven {
48      url "$rootDir/versioned-abis/expoview-abi39_0_0/maven"
49    }
50    maven {
51      url "$rootDir/versioned-abis/expoview-abi38_0_0/maven"
52    }
53    maven {
54      url "$rootDir/versioned-abis/maven"
55    }
56    google()
57    jcenter()
58    maven {
59      // Local Maven repo containing AARs with JSC built for Android
60      url "$rootDir/../node_modules/jsc-android/dist"
61    }
62    maven {
63      // Local expo-camera Maven repo containing our slightly modified
64      // Google's cameraview from expo/cameraview.
65      url "$rootDir/../packages/expo-camera/android/maven"
66    }
67    flatDir {
68      dirs 'libs'
69      // dirs project(':expoview').file('libs')
70    }
71    // https://github.com/google/ExoPlayer/issues/5225#issuecomment-445739013
72    maven { url 'https://google.bintray.com/exoplayer' }
73    // Using www.jitpack.io instead of plain jitpack.io due to
74    // https://github.com/jitpack/jitpack.io/issues/4002
75    maven { url "https://www.jitpack.io" }
76
77    // Want this last so that we never end up with a stale cache
78    mavenLocal()
79  }
80
81  configurations.all {
82    // WHEN_DISTRIBUTING_REMOVE_FROM_HERE
83    resolutionStrategy.dependencySubstitution {
84      substitute module("com.facebook.react:react-native:+") with project(":ReactAndroid")
85
86      // Gradle needs another hint (apart from plain dependency substitution)
87      // to know that it should first evaluate the replacing project before resolving
88      // classpaths etc. Without this block an error is thrown when running tests
89      // in a project that depends on react-native (eg. expo-updates):
90      //   > No matching configuration of project :ReactAndroid was found.
91      //   > The consumer was configured to find a runtime of a component,
92      //   > as well as attribute 'com.android.build.api.attributes.BuildTypeAttr'
93      //   > with value 'debug' but:
94      //   >   - None of the consumable configurations have attributes.
95      all {
96        if (requested.displayName == "com.facebook.react:react-native:+") {
97          evaluationDependsOn(":ReactAndroid")
98        }
99      }
100    }
101    // WHEN_DISTRIBUTING_REMOVE_TO_HERE
102  }
103}
104
105task clean(type: Delete) {
106  delete rootProject.buildDir
107}
108