build.gradle 4.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152
  1. apply plugin: 'com.android.library'
  2. android {
  3. compileSdkVersion 28
  4. buildToolsVersion '28.0.3'
  5. defaultConfig {
  6. minSdkVersion 14
  7. targetSdkVersion 28
  8. versionCode 18
  9. versionName "2.6.4"
  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 'com.android.support:appcompat-v7:28.0.0'
  21. implementation 'com.android.support:cardview-v7:28.0.0'
  22. //这两个是必须要加的,其它的可供选择
  23. implementation 'tv.danmaku.ijk.media:ijkplayer-java:0.8.8'
  24. implementation 'tv.danmaku.ijk.media:ijkplayer-armv7a:0.8.4'
  25. //其他库文件
  26. //implementation 'tv.danmaku.ijk.media:ijkplayer-armv5:0.8.8'
  27. //implementation 'tv.danmaku.ijk.media:ijkplayer-arm64:0.8.8'
  28. //implementation 'tv.danmaku.ijk.media:ijkplayer-x86:0.8.8'
  29. //implementation 'tv.danmaku.ijk.media:ijkplayer-x86_64:0.8.8'
  30. }
  31. /** 以下开始是将Android Library上传到jcenter的相关配置**/
  32. apply plugin: 'com.github.dcendents.android-maven'
  33. apply plugin: 'com.jfrog.bintray'
  34. //项目主页
  35. def siteUrl = 'https://github.com/yangchong211/YCVideoPlayer' // project homepage
  36. //项目的版本控制地址
  37. def gitUrl = 'https://github.com/yangchong211/YCVideoPlayer.git' // project git
  38. //发布到组织名称名字,必须填写
  39. group = "cn.yc"
  40. //发布到JCenter上的项目名字,必须填写
  41. def libName = "YCVideoPlayerLib"
  42. // 版本号,下次更新是只需要更改版本号即可
  43. version = "2.6.6"
  44. /** 上面配置后上传至jcenter后的编译路径是这样的: compile 'cn.yc:YCVideoPlayerLib:2.4' **/
  45. //生成源文件
  46. task sourcesJar(type: Jar) {
  47. from android.sourceSets.main.java.srcDirs
  48. classifier = 'sources'
  49. }
  50. //生成文档
  51. task javadoc(type: Javadoc) {
  52. source = android.sourceSets.main.java.srcDirs
  53. classpath += project.files(android.getBootClasspath().join(File.pathSeparator))
  54. options.encoding "UTF-8"
  55. options.charSet 'UTF-8'
  56. options.author true
  57. options.version true
  58. options.links "https://github.com/linglongxin24/FastDev/tree/master/mylibrary/docs/javadoc"
  59. failOnError false
  60. }
  61. //文档打包成jar
  62. task javadocJar(type: Jar, dependsOn: javadoc) {
  63. classifier = 'javadoc'
  64. from javadoc.destinationDir
  65. }
  66. //拷贝javadoc文件
  67. task copyDoc(type: Copy) {
  68. from "${buildDir}/docs/"
  69. into "docs"
  70. }
  71. //上传到jcenter所需要的源码文件
  72. artifacts {
  73. archives javadocJar
  74. archives sourcesJar
  75. }
  76. // 配置maven库,生成POM.xml文件
  77. install {
  78. repositories.mavenInstaller {
  79. // This generates POM.xml with proper parameters
  80. pom {
  81. project {
  82. packaging 'aar'
  83. //项目描述,自由填写
  84. name 'This is videoPlayer lib'
  85. url siteUrl
  86. licenses {
  87. license {
  88. //开源协议
  89. name 'The Apache Software License, Version 2.0'
  90. url 'http://www.apache.org/licenses/LICENSE-2.0.txt'
  91. }
  92. }
  93. developers {
  94. developer {
  95. //开发者的个人信息,根据个人信息填写
  96. id 'yangchong'
  97. name 'yc'
  98. email 'yangchong211@163.com'
  99. }
  100. }
  101. scm {
  102. connection gitUrl
  103. developerConnection gitUrl
  104. url siteUrl
  105. }
  106. }
  107. }
  108. }
  109. }
  110. //上传到jcenter
  111. Properties properties = new Properties()
  112. properties.load(project.rootProject.file('local.properties').newDataInputStream())
  113. bintray {
  114. user = properties.getProperty("bintray.user") //读取 local.properties 文件里面的 bintray.user
  115. key = properties.getProperty("bintray.apikey") //读取 local.properties 文件里面的 bintray.apikey
  116. configurations = ['archives']
  117. pkg {
  118. repo = "maven"
  119. name = libName //发布到JCenter上的项目名字,必须填写
  120. desc = 'android videoPlayer' //项目描述
  121. websiteUrl = siteUrl
  122. vcsUrl = gitUrl
  123. licenses = ["Apache-2.0"]
  124. publish = true
  125. }
  126. }
  127. javadoc {
  128. options {
  129. //如果你的项目里面有中文注释的话,必须将格式设置为UTF-8,不然会出现乱码
  130. encoding "UTF-8"
  131. charSet 'UTF-8'
  132. author true
  133. version true
  134. links "http://docs.oracle.com/javase/7/docs/api"
  135. }
  136. }