I want to include a library in Android Studio , but it displays error like below :
"Failed to resolve:com.lemonlab:expandable-button-menu:1.0.0"
How to fix this problem?
apply plugin: 'com.android.application'
android {
compileSdkVersion 21
buildToolsVersion '21.1.2'
defaultConfig {
applicationId "ayowes.com.newecampus"
minSdkVersion 15
targetSdkVersion 21
versionCode 1
versionName "1.0"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android-ptimize.txt'), 'proguard-rules.txt'
}
}
}
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
compile 'com.android.support:appcompat-v7:21.0.3'
compile 'com.google.android.gms:play-services:6.5.87'
compile 'com.lemonlab:expandable-button-menu:1.0.0'
compile files('libs/pinchzoom.jar')
}
Solved by using "http://jcenter.bintray.com/" instead of "https://jcenter.bintray.com/".
repositories {
jcenter( { url "http://jcenter.bintray.com/" } )
}
repositories {
mavenCentral()
}
I added this in build.gradle, and it worked.
I had the same problem, the first thing that came to mind was repositories. So I checked the build.gradle
file for the whole project and added the following code, then synchronized the gradle with project and problem was solved!
allprojects {
repositories {
jcenter()
}
}
Check to see if your gradle is offline. Preferences-ProjectSettings-Gradle. If you're trying to add a library while offline, you'll see that error. Also, try Build-Clean, it may provide you with more detail.
Well, it's co.lemonlabs
, you have a typo in your build.gradle
:
compile 'co.lemonlabs:expandable-button-menu:1.0.0'
Source: https://github.com/lemonlabs/ExpandableButtonMenu#including-in-your-project
i had the same problem, i added the following lines in build.gradle
allprojects {
repositories {
jcenter()
maven { url "https://jitpack.io" }
maven {
url 'http://dl.bintray.com/dev-fingerlinks/maven'
}
mavenCentral()
}
}
Try this
Some time you may just need to add maven { url "https://jitpack.io" }
in your allprojects block in project level build.gradle file.
Example:
allprojects {
repositories {
jcenter()
maven { url "https://jitpack.io" }
}
}
You go File->Settings->Gradle Look at the "Offline work" inbox, if it's checked u uncheck and try to sync again I have the same problem and i try this , the problem resolved. Good luck !
For me follwing steps helped.
It seems to be bug of Android Studio 3.4/3.5 and it was "fixed" by disabling:
File ? Settings ? Experimental ? Gradle ? Only sync the active variant
Source: Stackoverflow.com