我正在构建一个用于音乐流媒体的Android库。它有ExoPlayer作为依赖(优秀的图书馆顺便说一句!)。
我们将这个库用于我们现在正在Xamarin开发的另一个项目。目前,我们需要添加两个库(我的.aar和.jar用于ExoPlayer)。说实话,这有点烦人,我喜欢把我的.aar放进去,然后走了。
所以有两个问题:
这是我当前的gradle文件。没什么好看的。但是当我将最初的应用程序转换为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'
}
在this issue解决之前没有解决方案,但是对于某人来说,一个可行的替代方案是使用“导入.JAR / .AAR包”单独捆绑.aar
,同时单击“New Module”。
这种方法的唯一问题是,您可以通过这种方式一次捆绑1个AAR,因此您需要为每个AAR创建一个模块。
另一种方法是尝试使用Mobbeel fat-aar插件,你可以在这里找到:
https://github.com/Mobbeel/fataar-gradle-plugin
它是目前唯一支持Android Gradle Plugin 3.1.X的产品,支持AGP 3.2和3.3跟踪here。它支持更多高级功能,但并非所有功能都正常工作(您需要针对特定用例进行尝试,看看它是否有效)