build.gradle 2.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586
  1. apply plugin: 'com.android.library'
  2. apply plugin: 'kotlin-android'
  3. apply plugin: 'kotlin-android-extensions'
  4. android {
  5. compileSdkVersion 26
  6. buildToolsVersion "27.0.3"
  7. defaultConfig {
  8. minSdkVersion 19
  9. targetSdkVersion 26
  10. versionCode 1
  11. versionName "1.0"
  12. }
  13. buildTypes {
  14. release {
  15. minifyEnabled false
  16. proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
  17. }
  18. }
  19. }
  20. dependencies {
  21. implementation fileTree(dir: 'libs', include: ['*.jar'])
  22. implementation 'com.android.support:appcompat-v7:26.1.0'
  23. //kotlin
  24. implementation "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version"
  25. //http框架
  26. implementation 'com.squareup.retrofit2:retrofit:2.4.0'
  27. implementation 'com.squareup.retrofit2:converter-gson:2.2.0'
  28. implementation 'com.squareup.retrofit2:adapter-rxjava:2.0.2'
  29. implementation 'com.squareup.okhttp3:okhttp:3.11.0'
  30. implementation 'io.reactivex:rxjava:1.1.6'
  31. implementation 'io.reactivex:rxandroid:1.2.1'
  32. implementation('com.github.bumptech.glide:glide:3.7.0') {
  33. force = true
  34. }
  35. }
  36. //添加以下方法
  37. //在 build/libs 目录下生成 makeKotlinJar.jar 文件
  38. // 这种方式生成的jar文件如果被kotlin app项目引用,则会出现kotlin库重复的错误,所以生成的jar
  39. //task makeJar(type: Jar) {
  40. // delete('build/libs/o2_auth_sdk.jar')
  41. // archiveName 'o2_auth_sdk.jar'
  42. // //添加项目中java生成的class文件目录
  43. // from('build/intermediates/classes/release/')
  44. // //添加项目中kotlin生成的class文件目录
  45. // from('build/tmp/kotlin-classes/release')
  46. //// 添加Kotlin库(方法1)
  47. // from {
  48. // String[] include = [
  49. // "kotlin-stdlib-${kotlin_version}.jar"
  50. // ]
  51. // configurations.compile
  52. // .findAll { include.contains(it.name) }
  53. // .collect { it.isDirectory() ? it : zipTree(it) }
  54. // }
  55. //
  56. // destinationDir = file('build/libs')
  57. //
  58. // exclude('android/**')
  59. //
  60. // include('**/**')
  61. //
  62. //}
  63. //
  64. //makeJar.dependsOn(build)
  65. // 将打包好的aar包拷贝到app下
  66. task copy2App(type: Copy) {
  67. from 'build/outputs/aar/o2_auth_sdk-release.aar'
  68. into '../app/libs'
  69. }
  70. copy2App.dependsOn(assemble)