我正在为音乐流构建一个 Android 库。它有 ExoPlayer作为依赖(优秀的库顺便说一句!)。
我们将此库用于我们目前也在 Xamarin 中开发的另一个项目。目前,我们需要添加两个库(我的 .aar 和 ExoPlayer 的 .jar)。老实说,这有点烦人,我很想把我的 .aar 放进去,然后继续。
所以两个问题:
- 有没有一种方法可以使用 gradle 和其他东西将 ExoPlayer bundle 在我的 .aar 中? (我在这里是一个初学者,请彻底)
- 我意识到这可能不是最好的做法(依赖性应该由应用程序管理,等等等等),但实际上我们每次更新前者时都会一起测试 ExoPlayer 和我的库。那么我不应该将 ExoPlayer bundle 到我的库中是否有充分的理由,或者这样可以吗?
这是我当前的 gradle 文件。虽然没有什么令人兴奋的。但是当我将初始应用程序转换为库时,也许有一些奇怪的东西,谁知道......
apply plugin: 'com.android.library'
android {
compileSdkVersion 23
buildToolsVersion "23.0.2"
defaultConfig {
minSdkVersion 19
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'])
compile ('com.google.android.exoplayer:exoplayer:r1.5.6')
testCompile 'junit:junit:4.12'
testCompile 'org.mockito:mockito-core:1.10.19'
compile 'com.android.support:appcompat-v7:23.2.0'
}
最佳答案
在 this issue 之前没有解决方案已解决,但对于某些人来说,一个可行的替代方案是在单击“新模块”时使用“导入 .JAR/.AAR 包”单独 bundle .aar
。
这种方法的唯一问题是您一次只能以这种方式 bundle 1 个 AAR,因此您需要为每个 AAR 创建一个模块。
或者,您可以尝试使用 Kezong fat aar 库:
https://github.com/kezong/fat-aar-android
关于android - 在我的 .aar 中 bundle 第三方库,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/36136670/