1

I am trying to include ShowcaseView library to my project using the dependency mentioned in readme file

compile 'com.github.amlcurran.showcaseview:library:5.0.0'

But Android Studio gives error for this. I am using Android Studio 1.0.2. Can anybody tell me what am I missing here?

Error:Could not download artifact 'library.aar (com.github.amlcurran.showcaseview:library:5.0.0)': No cached version available for offline mode

SMR
  • 6,628
  • 2
  • 35
  • 56
Ashwani K
  • 7,880
  • 19
  • 63
  • 102
  • 1
    Check it out here http://stackoverflow.com/questions/22607661/no-cached-version-of-com-android-tools-buildgradle0-9-1-available-for-offline – Psypher Mar 09 '15 at 06:57

2 Answers2

5

In your build.gradle include http://jcenter.bintray.com as a repository before mavenCentral like this:

repositories {
    maven { url "http://jcenter.bintray.com" }
    mavenCentral()
}

Use in your project dependencies as usual:

dependencies {
    compile 'com.github.amlcurran.showcaseview:library:5.0.0'
}

Why prior to mavenCentral?

Otherwise gradle will look first in mavenCentral, find ShowCaseView artifact with the same version, but won't find the package and will report an error, without looking for same artifact with another packaging in other repositories.

Additional Hint:

If you face this kind of error for any other libraries go to bintray.com ans search for the library that you want. If it is found there then click on the library and u can find the instructions on how to setup that library. Hope it helps many people who comes and searches for the same query.

Gowtham Raj
  • 2,915
  • 1
  • 24
  • 38
  • 2
    Nice answer +1. Any reference supporting your ***"Why prior to mavenCentral?"*** part? – SMR Mar 09 '15 at 07:17
  • 2
    @SMR Here is a link to the gradle doc that answers ur query http://gradle.org/docs/current/userguide/artifact_dependencies_tutorial.html#N10621 – Gowtham Raj Mar 09 '15 at 07:22
  • 1
    U can find even more info from this link too.... have a look into it ... http://gradle.org/docs/current/userguide/dependency_management.html#sec:repositories – Gowtham Raj Mar 09 '15 at 07:25
  • try it https://stackoverflow.com/questions/22141856/android-showcase-view-how-to-use/52619873#52619873 – Sanjay Hadiya Oct 03 '18 at 04:53
1

I will assume that your are adding the compile line for the library correctly in the Build.gradle (Module: app) file in the dependency section.

Then make sure of two things:

1)Restart your IDE

2)You have an internet connection.

3)Adding the MavenCentral() to your repositories in the build.gradle (Project: you_project_name) in the buildscript section

repositories {
mavenCentral()
} 

4)Click on Sync Now

Have a look on this answer

Community
  • 1
  • 1
Sami Eltamawy
  • 9,874
  • 8
  • 48
  • 66