Exoplayer库版本冲突

时间:2018-03-15 05:48:30

标签: java android

目前,我正在使用版本为2.3.1的exoplayer库。我想在同一个项目中包含exoplayer版本2.7.0我们怎么能没有冲突呢?如果有人的答案最受欢迎,但请不要关闭我的问题,因为我为主题工作的组织,他们有不同的供应商,所以他们的要求是针对不同的版本,所以我不知道为什么我想这样做。< / p>

了解更多信息https://github.com/google/ExoPlayer/issues/3988

2 个答案:

答案 0 :(得分:1)

将/constants.gradle复制到您的项目中: 并使用以下命令替换build.gradle数据:

apply plugin: 'com.android.library'
apply from: '../constants.gradle'

android {
    compileSdkVersion project.ext.compileSdkVersion
    buildToolsVersion project.ext.buildToolsVersion

    defaultConfig {
        minSdkVersion project.ext.minSdkVersion
        targetSdkVersion project.ext.targetSdkVersion
        consumerProguardFiles 'proguard-rules.txt'
    }

    // Workaround to prevent circular dependency on project :testutils.
    sourceSets {
        androidTest {
            java.srcDirs += "../../testutils/src/main/java/"
        }
        test {
            java.srcDirs += "../../testutils/src/main/java/"
            java.srcDirs += "../../testutils_robolectric/src/main/java/"
        }
    }

    buildTypes {
        // Re-enable test coverage when the following issue is fixed:
        // https://issuetracker.google.com/issues/37019591
        // debug {
        //    testCoverageEnabled = true
        // }
    }
}

dependencies {
    implementation 'com.android.support:support-annotations:' + supportLibraryVersion
    androidTestImplementation 'com.google.dexmaker:dexmaker:' + dexmakerVersion
    androidTestImplementation 'com.google.dexmaker:dexmaker-mockito:' + dexmakerVersion
    androidTestImplementation 'com.google.truth:truth:' + truthVersion
    androidTestImplementation 'org.mockito:mockito-core:' + mockitoVersion
    testImplementation 'com.google.truth:truth:' + truthVersion
    testImplementation 'junit:junit:' + junitVersion
    testImplementation 'org.mockito:mockito-core:' + mockitoVersion
    testImplementation 'org.robolectric:robolectric:' + robolectricVersion
}

ext {
    javadocTitle = 'Core module'
}

ext {
    releaseArtifact = 'exoplayer-core'
    releaseDescription = 'The ExoPlayer library core module.'
}

答案 1 :(得分:0)

def rootDir = gradle.ext.exoplayerRoot
def modulePrefix = ':'
if (gradle.ext.has('exoplayerModulePrefix')) {
    modulePrefix += gradle.ext.exoplayerModulePrefix
 }

include modulePrefix + 'library'
include modulePrefix + 'library-core'
include modulePrefix + 'library-dash'
include modulePrefix + 'library-hls'
include modulePrefix + 'library-smoothstreaming'
include modulePrefix + 'library-ui'
include modulePrefix + 'testutils'
include modulePrefix + 'testutils-robolectric'
include modulePrefix + 'extension-ffmpeg'
include modulePrefix + 'extension-flac'
include modulePrefix + 'extension-gvr'
include modulePrefix + 'extension-ima'
include modulePrefix + 'extension-cast'
include modulePrefix + 'extension-mediasession'
include modulePrefix + 'extension-okhttp'
include modulePrefix + 'extension-opus'
include modulePrefix + 'extension-vp9'
include modulePrefix + 'extension-rtmp'
include modulePrefix + 'extension-leanback'

project(modulePrefix + 'library').projectDir = new File(rootDir,         
'library/all')
project(modulePrefix + 'library-core').projectDir = new File(rootDir, 
'library/core')
project(modulePrefix + 'library-dash').projectDir = new File(rootDir, 
'library/dash')
project(modulePrefix + 'library-hls').projectDir = new File(rootDir, 
'library/hls')
project(modulePrefix + 'library-smoothstreaming').projectDir = new 
File(rootDir, 'library/smoothstreaming')
project(modulePrefix + 'library-ui').projectDir = new File(rootDir, 
'library/ui')
project(modulePrefix + 'testutils').projectDir = new File(rootDir, 
'testutils')
project(modulePrefix + 'testutils-robolectric').projectDir = new 
File(rootDir, 'testutils_robolectric')
 project(modulePrefix + 'extension-ffmpeg').projectDir = new File(rootDir, 
 'extensions/ffmpeg')
 project(modulePrefix + 'extension-flac').projectDir = new File(rootDir, 
 'extensions/flac')
project(modulePrefix + 'extension-gvr').projectDir = new File(rootDir, 
 'extensions/gvr')
project(modulePrefix + 'extension-ima').projectDir = new File(rootDir, 
'extensions/ima')
project(modulePrefix + 'extension-cast').projectDir = new File(rootDir, 
 'extensions/cast')
project(modulePrefix + 'extension-mediasession').projectDir = new 
File(rootDir, 'extensions/mediasession')
project(modulePrefix + 'extension-okhttp').projectDir = new File(rootDir, 
 'extensions/okhttp')
project(modulePrefix + 'extension-opus').projectDir = new File(rootDir, 
'extensions/opus')
project(modulePrefix + 'extension-vp9').projectDir = new File(rootDir, 
'extensions/vp9')
project(modulePrefix + 'extension-rtmp').projectDir = new File(rootDir, 
'extensions/rtmp')
project(modulePrefix + 'extension-leanback').projectDir = new File(rootDir, 
'extensions/leanback')

if (gradle.ext.has('exoplayerIncludeCronetExtension')
    && gradle.ext.exoplayerIncludeCronetExtension) {
include modulePrefix + 'extension-cronet'
project(modulePrefix + 'extension-cronet').projectDir = new File(rootDir, 
'extensions/cronet')
}