Ei kuvausta

build.gradle 2.5KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192
  1. buildscript {
  2. ext.kotlin_version = '1.2.71'
  3. repositories {
  4. google()
  5. jcenter()
  6. maven {
  7. url 'https://maven.fabric.io/public'
  8. }
  9. }
  10. dependencies {
  11. classpath 'com.android.tools.build:gradle:3.2.1'
  12. classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
  13. }
  14. }
  15. apply plugin: 'com.android.library'
  16. apply plugin: 'kotlin-android'
  17. def DEFAULT_COMPILE_SDK_VERSION = 27
  18. def DEFAULT_BUILD_TOOLS_VERSION = "28.0.3"
  19. def DEFAULT_TARGET_SDK_VERSION = 27
  20. android {
  21. compileSdkVersion rootProject.hasProperty('compileSdkVersion') ? rootProject.compileSdkVersion : DEFAULT_COMPILE_SDK_VERSION
  22. buildToolsVersion rootProject.hasProperty('buildToolsVersion') ? rootProject.buildToolsVersion : DEFAULT_BUILD_TOOLS_VERSION
  23. defaultConfig {
  24. minSdkVersion 16
  25. targetSdkVersion rootProject.hasProperty('targetSdkVersion') ? rootProject.targetSdkVersion : DEFAULT_TARGET_SDK_VERSION
  26. versionCode 1
  27. versionName "1.0"
  28. }
  29. buildTypes {
  30. release {
  31. minifyEnabled false
  32. }
  33. }
  34. productFlavors {
  35. }
  36. lintOptions {
  37. disable 'GradleCompatible'
  38. }
  39. compileOptions {
  40. sourceCompatibility JavaVersion.VERSION_1_8
  41. targetCompatibility JavaVersion.VERSION_1_8
  42. }
  43. }
  44. repositories {
  45. mavenCentral()
  46. maven {
  47. url 'https://maven.google.com/'
  48. name 'Google'
  49. }
  50. // Stolen from react-native-firebase, thanks dudes!
  51. def found = false
  52. def parentDir = rootProject.projectDir
  53. def reactNativeAndroidName = 'React Native (Node Modules)'
  54. 1.upto(4, {
  55. if (found) return true
  56. parentDir = parentDir.parentFile
  57. def reactNativeAndroid = new File(
  58. parentDir,
  59. 'node_modules/react-native/android'
  60. )
  61. if (reactNativeAndroid.exists()) {
  62. maven {
  63. url reactNativeAndroid.toString()
  64. name reactNativeAndroidName
  65. }
  66. println "${project.name}: using React Native sources from ${reactNativeAndroid.toString()}"
  67. found = true
  68. }
  69. })
  70. if (!found) {
  71. throw new GradleException(
  72. "${project.name}: unable to locate React Native Android sources, " +
  73. "ensure you have you installed React Native as a dependency and try again."
  74. )
  75. }
  76. }
  77. dependencies {
  78. implementation 'com.facebook.react:react-native:+'
  79. implementation "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version"
  80. }