build.gradle 5.1 KB

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