我尝试在我的项目中包含 aacdecoder (https://github.com/vbartacek/aacdecoder-android)。在解码器自述文件中说我的依赖是
<dependency>
<groupId>com.spoledge.aacdecoder</groupId>
<artifactId>aacdecoder-lib</artifactId>
<version>0.8</version>
<type>apklib</type>
</dependency>
但是当我像这样在我的 build.gradle 中使用时
compile 'com.spoledge.aacdecoder:aacdecoder-lib:0.8'
当我尝试同步它时它失败了。
在 jitpack.io 之后(感谢 OleGG),就像在图像中一样(缺点)它不像 exoplayer 那样出现。
最佳答案
从 maven 库定义中可以看出,它以 <type>apklib</type>
的形式分发。 ,并且 Gradle 不支持 apklib。
最简单的解决方案是将这个库打包到你的仓库中。您也可以按照此问题 How to convert apklib to aar 中的说明进行操作,但无论如何它都会导致应用重新打包。
您也可以尝试使用https://jitpack.io自动打包。在这种情况下,您需要将 jitpack repo 添加到您的根目录 build.gradle
像这样的文件:
allprojects {
repositories {
jcenter()
maven { url "https://jitpack.io" }
}
}
然后在适当的模块中提供 github repo 作为依赖项:
dependencies {
compile 'com.github.vbartacek:aacdecoder-android:0.8'
}
关于android studio导入没有gradle的maven项目,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/35372741/