我正在使用 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/