【问题标题】:Creating aar of Android Library containing jar and aar创建包含 jar 和 aar 的 Android 库的 aar
【发布时间】:2016-08-17 04:59:50
【问题描述】:

我有一个 Android 库 MyLib,我需要在其中创建 Android 存档 (aar)。这个库使用了另外两个依赖,一个是 abc.jar,另一个是 xyz.aar

我在库的 /libs 文件夹中有 abc.jar 文件,对于 xyz.aar 将其添加为模块依赖项.

库的gradle文件长这样

apply plugin: 'com.android.library'

android {
    compileSdkVersion 24
    buildToolsVersion "24.0.0"

    defaultConfig {
        minSdkVersion 15
        targetSdkVersion 24
        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:24.1.1'
    compile project(':xyz')
}

一旦我为 MyLib 创建了 aar 文件并尝试将其与示例项目一起使用,我就无法使用 xyz.aar 中的类,而作为 abc.jar 可访问。

这让我想知道一个 aar 是否可以在其中包含另一个 aar 依赖项。因此是否可以在 anot 中访问 aar

【问题讨论】:

  • 如何将 MyLib aar 包含到示例项目中?作为模块依赖、文件依赖还是maven依赖?

标签: android jar dependencies android-library aar


【解决方案1】:

使用android-fat-aar创建包含另一个aar的Android库的aar

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2015-02-24
    • 1970-01-01
    • 2015-01-24
    • 2015-01-10
    • 1970-01-01
    • 2016-01-17
    相关资源
    最近更新 更多