build.gradle 1.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758
  1. apply plugin: 'com.android.library'
  2. apply plugin: 'com.github.dcendents.android-maven'
  3. android {
  4. compileSdkVersion 27
  5. defaultConfig {
  6. minSdkVersion 14
  7. targetSdkVersion 27
  8. versionCode 1
  9. versionName "1.0"
  10. }
  11. buildTypes {
  12. release {
  13. minifyEnabled false
  14. proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
  15. }
  16. }
  17. }
  18. dependencies {
  19. implementation fileTree(dir: 'libs', include: ['*.jar'])
  20. implementation 'androidx.appcompat:appcompat:1.0.0'
  21. implementation 'androidx.recyclerview:recyclerview:1.0.0'
  22. implementation 'com.google.android.material:material:1.0.0'
  23. }
  24. // 指定编码
  25. tasks.withType(JavaCompile) {
  26. options.encoding = "UTF-8"
  27. }
  28. // 打包源码
  29. task sourcesJar(type: Jar) {
  30. from android.sourceSets.main.java.srcDirs
  31. classifier = 'sources'
  32. }
  33. task javadoc(type: Javadoc) {
  34. failOnError false
  35. source = android.sourceSets.main.java.sourceFiles
  36. classpath += project.files(android.getBootClasspath().join(File.pathSeparator))
  37. classpath += configurations.compile
  38. }
  39. // 制作文档(Javadoc)
  40. task javadocJar(type: Jar, dependsOn: javadoc) {
  41. classifier = 'javadoc'
  42. from javadoc.destinationDir
  43. }
  44. artifacts {
  45. archives sourcesJar
  46. archives javadocJar
  47. }