build.gradle 5.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159
  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 40
  9. versionName "3.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.2.0'
  21. implementation 'androidx.annotation:annotation:1.1.0'
  22. implementation 'androidx.cardview:cardview:1.0.0'
  23. implementation project(':VideoKernel')
  24. /*//这两个是必须要加的,其它的可供选择
  25. //ijk播放器
  26. implementation 'tv.danmaku.ijk.media:ijkplayer-java:0.8.8'
  27. implementation 'tv.danmaku.ijk.media:ijkplayer-armv7a:0.8.4'
  28. //其他库文件
  29. //implementation 'tv.danmaku.ijk.media:ijkplayer-armv5:0.8.8'
  30. //implementation 'tv.danmaku.ijk.media:ijkplayer-arm64:0.8.8'
  31. //implementation 'tv.danmaku.ijk.media:ijkplayer-x86:0.8.8'
  32. //implementation 'tv.danmaku.ijk.media:ijkplayer-x86_64:0.8.8'
  33. //谷歌播放器
  34. implementation "com.google.android.exoplayer:exoplayer:2.11.3"
  35. implementation "com.google.android.exoplayer:exoplayer-core:2.11.3"
  36. implementation "com.google.android.exoplayer:exoplayer-dash:2.11.3"
  37. implementation "com.google.android.exoplayer:exoplayer-hls:2.11.3"
  38. implementation "com.google.android.exoplayer:exoplayer-smoothstreaming:2.11.3"
  39. implementation "com.google.android.exoplayer:extension-rtmp:2.11.3"*/
  40. }
  41. /** 以下开始是将Android Library上传到jcenter的相关配置**/
  42. apply plugin: 'com.github.dcendents.android-maven'
  43. apply plugin: 'com.jfrog.bintray'
  44. //项目主页
  45. def siteUrl = 'https://github.com/yangchong211/YCVideoPlayer' // project homepage
  46. //项目的版本控制地址
  47. def gitUrl = 'https://github.com/yangchong211/YCVideoPlayer.git' // project git
  48. //发布到组织名称名字,必须填写
  49. group = "cn.yc"
  50. //发布到JCenter上的项目名字,必须填写
  51. def libName = "VideoPlayer"
  52. // 版本号,下次更新是只需要更改版本号即可
  53. version = "3.1.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 videoPlayer 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 videoPlayer' //项目描述
  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. }