Adding Joda Time to Android Studio

Cai picture Cai · Mar 24, 2015 · Viewed 37.3k times · Source

I got the file from the Joda site and followed these instructions for adding libraries but when I get to the Gradle sync I end up with the error:

Gradle Sync

Error:Configuration with name 'default' not found.

Gradle Build

Error:A problem occurred configuring project ':app'. 
> Cannot evaluate module joda : Configuration with name 'default' not found.

A bit confused, I looked around and read that the library should have it's own gradle files but the joda package doesn't. When I try to use import org.joda.time; it can't resolve joda. Does anyone have any idea of what I'm doing wrong?

Answer

Amit K. Saha picture Amit K. Saha · Mar 24, 2015

in app/build.gradle file, add like this-

dependencies {    
    compile 'joda-time:joda-time:2.9.4'
}

You don't need to do anything else.

You need the latest release, check out the release page https://github.com/JodaOrg/joda-time/releases and change the version accordingly.