[英]Bundle third-party library in my .aar
I'm building an Android library for music streaming.我正在构建一个用于音乐流媒体的 Android 库。 It has ExoPlayer as dependency (excellent library btw!).它有ExoPlayer作为依赖项(顺便说一句,优秀的库!)。
We use this library for another project that we're also developing right now, in Xamarin.我们将此库用于我们目前也在 Xamarin 中开发的另一个项目。 Currently, we need to add both libraries (my .aar and a .jar for ExoPlayer).目前,我们需要添加两个库(我的 .aar 和 ExoPlayer 的 .jar)。 That's a bit annoying to be honest, I'd love to just drop my .aar in, and go.老实说这有点烦人,我很想把我的 .aar 放进去,然后去。
So two questions:所以两个问题:
And here's my current gradle file.这是我当前的 gradle 文件。 Nothing exciting to look at though.不过,没有什么令人兴奋的。 But as I converted the initial app to a lib, maybe there's something odd, who knows...但是当我将初始应用程序转换为 lib 时,也许有些奇怪,谁知道...
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'
}
There are no solutions for this until this issue is solved, but a viable alternative for someone can be to bundle the .aar
(s) singularly using the "Import .JAR/.AAR Package" while clicking on "New Module".在解决此问题之前没有解决方案,但对于某些人来说,一个可行的替代方案是在单击“新模块”的同时使用“导入 .JAR/.AAR 包”单独捆绑.aar
(s)。
The only problem with this approach is that you can bundle only 1 AAR at a time in this way, so you need to create a module for each one of them.这种方法的唯一问题是您一次只能捆绑 1 个 AAR,因此您需要为每个 AAR 创建一个模块。
In alternative you can try with Kezong fat aar library:或者,您可以尝试使用 Kezong fat aar 库:
https://github.com/kezong/fat-aar-android https://github.com/kezong/fat-aar-android
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.