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 28
  6. buildToolsVersion "28.0.3"
  7. defaultConfig {
  8. minSdkVersion 19
  9. targetSdkVersion 28
  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 'androidx.lifecycle:lifecycle-viewmodel:2.2.0'
  23. implementation 'androidx.appcompat:appcompat:1.2.0'
  24. //kotlin
  25. implementation "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version"
  26. //http框架
  27. implementation 'com.squareup.retrofit2:retrofit:2.4.0'
  28. implementation 'com.squareup.retrofit2:converter-gson:2.2.0'
  29. implementation 'com.squareup.retrofit2:adapter-rxjava:2.0.2'
  30. implementation 'com.squareup.okhttp3:okhttp:3.11.0'
  31. implementation 'io.reactivex:rxjava:1.1.6'
  32. implementation 'io.reactivex:rxandroid:1.2.1'
  33. implementation('com.github.bumptech.glide:glide:3.7.0') {
  34. force = true
  35. }
  36. }
  37. //添加以下方法
  38. //在 build/libs 目录下生成 makeKotlinJar.jar 文件
  39. // 这种方式生成的jar文件如果被kotlin app项目引用,则会出现kotlin库重复的错误,所以生成的jar
  40. //task makeJar(type: Jar) {
  41. // delete('build/libs/o2_auth_sdk.jar')
  42. // archiveName 'o2_auth_sdk.jar'
  43. // //添加项目中java生成的class文件目录
  44. // from('build/intermediates/classes/release/')
  45. // //添加项目中kotlin生成的class文件目录
  46. // from('build/tmp/kotlin-classes/release')
  47. //// 添加Kotlin库(方法1)
  48. // from {
  49. // String[] include = [
  50. // "kotlin-stdlib-${kotlin_version}.jar"
  51. // ]
  52. // configurations.compile
  53. // .findAll { include.contains(it.name) }
  54. // .collect { it.isDirectory() ? it : zipTree(it) }
  55. // }
  56. //
  57. // destinationDir = file('build/libs')
  58. //
  59. // exclude('android/**')
  60. //
  61. // include('**/**')
  62. //
  63. //}
  64. //
  65. //makeJar.dependsOn(build)
  66. // 将打包好的aar包拷贝到app下
  67. task copy2App(type: Copy) {
  68. from 'build/outputs/aar/o2_auth_sdk-release.aar'
  69. into '../app/libs'
  70. }
  71. copy2App.dependsOn(assemble)