Android Studio gradle sync,尝试错误下载jar而不是aar

标签 android maven android-studio gradle

我正在使用 Android Studio 1.4 预览版 3,gradle 插件 1.3。 嗨,我上传了一个 aar 包到 bintray jcenter:

https://bintray.com/kevinho/maven/opencore-amr-android/view

我这样设置存储库:

buildscript {
    repositories {
        jcenter()
    }
    dependencies {
        classpath 'com.android.tools.build:gradle:1.3.0'
        classpath 'com.jfrog.bintray.gradle:gradle-bintray-plugin:1.2'
        classpath 'com.github.dcendents:android-maven-gradle-plugin:1.3'
    }
}

allprojects {
    repositories {
        jcenter()
    }
}

当我尝试将它用作依赖项时,

dependencies {
    compile fileTree(dir: 'libs', include: ['*.jar'])
    compile 'com.hikvh:opencore-amr-android:1.0.0'
}

我收到以下错误:

Error:A problem occurred configuring project ':app'. Could not find opencore-amr-android.jar (com.hikvh:opencore-amr-android:1.0.0). Searched in the following locations: https://jcenter.bintray.com/com/hikvh/opencore-amr-android/1.0.0/opencore-amr-android-1.0.0.jar

我的问题是: 为什么 gradle 默认尝试加载 jar 而不是 aar 文件? 以及如何解决这个问题?

最佳答案

您需要告诉 Gradle 您正在尝试引用 AAR,而不是 JAR。

替换

编译 'com.hikvh:opencore-amr-android:1.0.0'

compile 'com.hikvh:opencore-amr-android:1.0.0@aar'

希望对您有所帮助。

关于Android Studio gradle sync,尝试错误下载jar而不是aar,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/32217248/

相关文章:

android - ionic 电话应用程序。设置在重启后仍然存在的警报。闹钟响起时打开应用程序

android - android中的阅读更多按钮

android - ActionNext 不适用于 android 中的多行 EditText

java - org.glassfish.jersey.containers 的“dependency.dependency.version”:jersey-container-grizzly2-http:jar is missing

maven - 为什么故障安全插件需要集成测试和验证目标?

java - 输出到模拟器时出现背景图像问题

屏幕亮起时 Android 脉冲 LED 通知

jaxb 编码时出现 javax.xml.bind.PropertyException

java - 从按钮和菜单项 JAVA 访问相同的 fragment

Android 12 待定意向