build.gradle 5.0 KB

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