build.gradle 2.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970
  1. apply plugin: 'com.android.library'
  2. android {
  3. compileSdkVersion cfgs.compileSdkVersion
  4. defaultConfig {
  5. minSdkVersion cfgs.minSdkVersion
  6. targetSdkVersion cfgs.targetSdkVersion
  7. consumerProguardFiles 'consumer-proguard-rules.pro'
  8. }
  9. def isBuildSo = false
  10. if (isBuildSo) { // 构建生成 so 文件
  11. sourceSets {
  12. main {
  13. jniLibs.srcDirs = []
  14. }
  15. }
  16. externalNativeBuild {
  17. ndkBuild {
  18. path 'src/main/jni/Android.mk'
  19. }
  20. }
  21. } else { // 生成 so 文件后,打包时直接使用生成的 so
  22. sourceSets {
  23. main {
  24. jni.srcDirs = []
  25. }
  26. }
  27. delete(file('.externalNativeBuild'), file('src/main/libs'), file('src/main/obj'))
  28. }
  29. packagingOptions { //避免重复导入库
  30. exclude 'lib/mips/libiconv.so'
  31. exclude 'lib/x86/libiconv.so'
  32. exclude 'lib/x86_64/libiconv.so'
  33. exclude 'lib/armeabi-v7a/libiconv.so'
  34. exclude 'lib/armeabi/libiconv.so'
  35. exclude 'lib/mips64/libiconv.so'
  36. exclude 'lib/arm64-v8a/libiconv.so'
  37. }
  38. }
  39. dependencies {
  40. // if (hasProperty("publishAar")) {
  41. // implementation "cn.bingoogolapple:bga-qrcode-core:${VERSION_NAME}"
  42. // } else {
  43. // api project(':qrcodecore')
  44. // }
  45. api project(':BSQrcodecore')
  46. implementation "androidx.appcompat:appcompat:${cfgs.appcompat_version}"
  47. implementation "androidx.legacy:legacy-support-v4:$cfgs.legacySupport"
  48. androidTestImplementation 'com.android.support.test:runner:1.0.2'
  49. androidTestImplementation('com.android.support.test.espresso:espresso-core:3.0.2', {
  50. exclude group: 'com.android.support', module: 'support-annotations'
  51. })
  52. testImplementation 'junit:junit:4.12'
  53. }
  54. // ./gradlew :zbar:clean :zbar:build :zbar:bintrayUpload -PpublishAar
  55. if (hasProperty("publishAar")) {
  56. apply from: 'https://raw.githubusercontent.com/bingoogolapple/PublishAar/master/jcenter-release.gradle'
  57. }
  58. tasks.whenTaskAdded {
  59. if (it.name == 'releaseAndroidJavadocs') {
  60. it.enabled = false
  61. }
  62. }