android studio import maven project without gradle

时间:2016-02-12 21:47:42

标签: android maven gradle

i try include aacdecoder (https://github.com/vbartacek/aacdecoder-android) to my project. In decoder readme says my dependency is

ActionMailer

but when i use in my build.gradle like this

<dependency>
        <groupId>com.spoledge.aacdecoder</groupId>
        <artifactId>aacdecoder-lib</artifactId>
        <version>0.8</version>
        <type>apklib</type>
</dependency>

it fail when i am try sync it.


After jitpack.io (thanks OleGG), like in image (downside) it isnt apper like exoplayer.

enter image description here

1 个答案:

答案 0 :(得分:1)

正如你从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'
}