【问题标题】:Built android library module doesn't have its dependencies inside内置的 android 库模块内部没有其依赖项
【发布时间】:2016-05-23 09:13:48
【问题描述】:

我构建了一个 Android 库模块,它具有一些依赖项(.aar 文件位于其 libs 目录中)。如果我将构建的.aar 文件导入到另一个项目中,它的依赖关系不会被解析。

apply plugin: 'com.android.library'

android {
    compileSdkVersion 23
    buildToolsVersion "23.0.2"

defaultConfig {
    minSdkVersion 16
    targetSdkVersion 23
    versionCode 1
    versionName "1.0"
}
buildTypes {
    release {
        minifyEnabled false
        proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
    }
}
}

dependencies {
    compile fileTree(dir: 'libs', include: ['*.jar'])
    testCompile 'junit:junit:4.12'
    compile 'com.android.support:appcompat-v7:23.1.1'
    //compile project(':ExoPlayer')
    compile(name: 'ExoPlayer', ext: 'aar')
    compile(name: 'Volley', ext: 'aar')
    compile 'com.danikula:videocache:2.3.4'
}

【问题讨论】:

  • 你添加了库的根目录吗?
  • @MathaN 你到底是什么意思?

标签: android gradle dependencies android-gradle-plugin android-library


【解决方案1】:

aar 文件不包含嵌套(或transitive)依赖项,并且没有描述库使用的依赖项的 pom 文件。

这意味着,如果您使用 flatDir repo 导入 aar 文件您还必须在项目中指定依赖项

【讨论】:

  • 你有没有更好的方法?
  • 你应该使用私有的 maven 仓库
猜你喜欢
  • 1970-01-01
  • 2013-11-05
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2014-02-10
  • 2020-10-30
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多