Nessuna descrizione

build.gradle 2.5KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293
  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. jcenter()
  47. maven {
  48. url 'https://maven.google.com/'
  49. name 'Google'
  50. }
  51. // Stolen from react-native-firebase, thanks dudes!
  52. def found = false
  53. def parentDir = rootProject.projectDir
  54. def reactNativeAndroidName = 'React Native (Node Modules)'
  55. 1.upto(4, {
  56. if (found) return true
  57. parentDir = parentDir.parentFile
  58. def reactNativeAndroid = new File(
  59. parentDir,
  60. 'node_modules/react-native/android'
  61. )
  62. if (reactNativeAndroid.exists()) {
  63. maven {
  64. url reactNativeAndroid.toString()
  65. name reactNativeAndroidName
  66. }
  67. println "${project.name}: using React Native sources from ${reactNativeAndroid.toString()}"
  68. found = true
  69. }
  70. })
  71. if (!found) {
  72. throw new GradleException(
  73. "${project.name}: unable to locate React Native Android sources, " +
  74. "ensure you have you installed React Native as a dependency and try again."
  75. )
  76. }
  77. }
  78. dependencies {
  79. implementation 'com.facebook.react:react-native:+'
  80. implementation "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version"
  81. }