I am using Android Studio 1.4 preview 3, gradle plugin 1.3. Hi, i upload a aar package to bintray jcenter:
https://bintray.com/kevinho/maven/opencore-amr-android/view
And i setup repositories like this:
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()
}
}
When I try to use it as a dependency,
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
compile 'com.hikvh:opencore-amr-android:1.0.0'
}
I get following error:
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
My question goes: Why gradle try to load jar instead aar file by default? And how to fix this?
You need to tell Gradle that you're trying to refer an AAR, not a JAR.
Replace
compile 'com.hikvh:opencore-amr-android:1.0.0'
with
compile 'com.hikvh:opencore-amr-android:1.0.0@aar'
Hope it helps.
Your dependency is loading as aar correctly.
Maybe library wasn't released by JCenter yet when you tried to download it.
Let's try to remove gradle cache.
1) Be sure that you have compile 'com.hikvh:opencore-amr-android:1.0.0'
in your dependencies.
2) From your home directory rm -rf ~/.gradle/caches
3) From you project root rm -rf .gradle
4) Run gradlew
from project ./gradlew assemble
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With