Ingen beskrivning

build.gradle 2.8KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697
  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. def DEFAULT_SUPPORT_LIB_VERSION = "27.0.2"
  21. android {
  22. compileSdkVersion rootProject.hasProperty('compileSdkVersion') ? rootProject.compileSdkVersion : DEFAULT_COMPILE_SDK_VERSION
  23. buildToolsVersion rootProject.hasProperty('buildToolsVersion') ? rootProject.buildToolsVersion : DEFAULT_BUILD_TOOLS_VERSION
  24. defaultConfig {
  25. minSdkVersion 16
  26. targetSdkVersion rootProject.hasProperty('targetSdkVersion') ? rootProject.targetSdkVersion : DEFAULT_TARGET_SDK_VERSION
  27. versionCode 1
  28. versionName "1.0"
  29. }
  30. buildTypes {
  31. release {
  32. minifyEnabled false
  33. }
  34. }
  35. productFlavors {
  36. }
  37. lintOptions {
  38. disable 'GradleCompatible'
  39. }
  40. compileOptions {
  41. sourceCompatibility JavaVersion.VERSION_1_8
  42. targetCompatibility JavaVersion.VERSION_1_8
  43. }
  44. }
  45. repositories {
  46. mavenCentral()
  47. jcenter()
  48. maven {
  49. url 'https://maven.google.com/'
  50. name 'Google'
  51. }
  52. // Stolen from react-native-firebase, thanks dudes!
  53. def found = false
  54. def parentDir = rootProject.projectDir
  55. def reactNativeAndroidName = 'React Native (Node Modules)'
  56. 1.upto(4, {
  57. if (found) return true
  58. parentDir = parentDir.parentFile
  59. def reactNativeAndroid = new File(
  60. parentDir,
  61. 'node_modules/react-native/android'
  62. )
  63. if (reactNativeAndroid.exists()) {
  64. maven {
  65. url reactNativeAndroid.toString()
  66. name reactNativeAndroidName
  67. }
  68. println "${project.name}: using React Native sources from ${reactNativeAndroid.toString()}"
  69. found = true
  70. }
  71. })
  72. if (!found) {
  73. throw new GradleException(
  74. "${project.name}: unable to locate React Native Android sources, " +
  75. "ensure you have you installed React Native as a dependency and try again."
  76. )
  77. }
  78. }
  79. def supportVersion = rootProject.hasProperty('supportLibVersion') ? rootProject.supportLibVersion : DEFAULT_SUPPORT_LIB_VERSION
  80. dependencies {
  81. implementation 'com.facebook.react:react-native:+'
  82. implementation "com.android.support:appcompat-v7:$supportVersion"
  83. implementation "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version"
  84. }