代码之家  ›  专栏  ›  技术社区  ›  dudi

从子模块添加依赖项

  •  0
  • dudi  · 技术社区  · 7 年前

    settings.gradle

    def modulePrefix = ":exoplayer:"
    def rootDir = new File('').toPath().toString()
    
    include ':exoplayer:library'
    include ':exoplayer:library'
    include ':exoplayer:library-core'
    include ':exoplayer:library-dash'
    include ':exoplayer:library-hls'
    include ':exoplayer:library-smoothstreaming'
    include ':exoplayer:library-ui'
    include ':exoplayer:extension-okhttp'
    
    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 + 'extension-okhttp').projectDir = new 
    File(rootDir, 'extensions/okhttp')
    

    现在,我将exoplayer libs的依赖项添加到 build.gradle

    implementation project(':exoplayer-library-core')
    implementation project(':exoplayer-library-dash')
    implementation project(':exoplayer-library-hls')
    implementation project(':exoplayer-library-smoothstreaming')
    implementation project(':exoplayer-library-ui')
    implementation project(':exoplayer-extension-okhttp')
    

    我得到这个错误

    Project with path ':exoplayer-library-core' could not be found in root 
    project 'myProject'
    
    1 回复  |  直到 7 年前
        1
  •  0
  •   Andres Rincon    7 年前

    我就是这样做的:

    设置.gradle:

    rootProject.name = 'main'
    
    include 'changelogs'
    include 'common'
    
    project(':changelogs').projectDir = new File(settingsDir, '../changelogs')
    project(':common').projectDir = new File(settingsDir, '../common')
    

    和Build.gradle

    implementation project(':changelogs')