1

I have a problem when adding Caldroid library on Android Studio. I try many different ways to add but it won't work. I use Android Studio 0.8.2.

  • First off, I created a root folder called libraries.
  • I created a new folder caldroid in /libraries.
  • Then, I pasted the downloaded files in /libraries folder.
  • Then, I changed the following files.

settings.gradle

include ':app'
include 'libraries:caldroid:library'

build.gradle

dependencies {
    compile 'com.android.support:appcompat-v7:20.+'
    compile 'com.google.android.gms:play-services:4.0.30'
    compile fileTree(dir: 'libs', include: ['*.jar'])
    compile project(':libraries:caldroid:library')
}

But I get this error:

Error:Configuration with name 'default' not found.

How to fix this?

Andrew T.
  • 4,701
  • 8
  • 43
  • 62
Olkunmustafa
  • 3,103
  • 9
  • 42
  • 55

2 Answers2

5

I'm late but I faced a similar issue so I thought I'll share how I solved it.

To import an external library to Android Studio, I follow this convention:

  1. Create libs folder inside the app directory. Then copy the required library files to the libs folder. For example, my folder contains actionbarsherlock and caldroid folders.
  2. Caldroid has a library dependency that can be downloaded here, you can see this in the build.gradle file (Also, make sure the gradle files have the correct SDK versions). Download the hirondelle-date4j-1.5.1-sources.jar.
  3. Create libs folder in app/libs/caldroid/. Copy the hirondelle-date4j-1.5.1-sources.jar to app/libs/caldroid/libs/. You may also have to copy android-support-v4.jar from -User_Home-/Android/Sdk/extras/android/support/v4/ to app/libs/caldroid/libs/.
  4. Open app/libs/caldroid/build.gradle and replace compile 'com.darwinsys:hirondelle-date4j:1.5.1' with compile files('libs/hirondelle-date4j-1.5.1-sources.jar').
  5. In Android Studio, open settings.gradle and add this line include ':app:libs:caldroid'. Next, open "build.gradle (Module: app)" and add this line compile project(':app:libs:caldroid') in dependencies.

And that's it, now allow the gradle to "sync" or clean and build your project.

Andrew T.
  • 4,701
  • 8
  • 43
  • 62
Ravikiran
  • 510
  • 1
  • 6
  • 12
  • First thanx @Ravi, I am using the gradle methods for import the Android libraries. Thus I can import with one line. – Olkunmustafa Jan 14 '15 at 09:56
4

Add this line in your dependencies in build.gradle

compile 'com.roomorama:caldroid:3.0.1'
Bronx
  • 4,480
  • 4
  • 34
  • 44
  • try adding the above line ("compile 'com.roomorama:caldroid:1.1.0'", that's all you need) and deleting "include 'libraries:caldroid:library'" and "compile project(':libraries:caldroid:library')" – Bronx Sep 01 '14 at 16:13
  • First thanx @Bronx. When I try to add diffrent library, these methods work. But I suppose this library not fixed. – Olkunmustafa Sep 02 '14 at 10:15