0

I would like to add this library from GitHub but it doesn't seem to be working when adding the following statement in the build.gradle file:

compile 'com.github.flavienlaurent.datetimepicker:library:0.0.2'

Project tree

I get the following error message:

UNEXPECTED TOP-LEVEL EXCEPTION:
com.android.dex.DexException: Multiple dex files define 

I read somewhere else that it had to do with the support-v4 library. How could I resolve this?

build.gradle file:

apply plugin: 'android'

android {
    compileSdkVersion 19
    buildToolsVersion '19.1.0'

defaultConfig {
    minSdkVersion 7
    targetSdkVersion 19
    versionCode 1
    versionName "1.0"
}
buildTypes {
    release {
        minifyEnabled false
        proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.txt'
    }
}}

 dependencies {
    compile 'com.android.support:appcompat-v7:19.1+'
    compile 'com.android.support:support-v4:19.0.0'
    compile files('libs/mpandroidchartlibrary-1-7-4.jar')
    compile files('libs/smartconfiglib.jar')
   // compile 'com.github.flavienlaurent.datetimepicker:library:0.0.2'
 }
Grégoire Borel
  • 1,880
  • 3
  • 33
  • 55
  • Have you see [this question](http://stackoverflow.com/questions/22468700/unexpected-top-level-exception-com-android-dex-dexexception-multiple-dex-files)? The answer there steps through an example resolution in a fair amount of detail. – stkent Jan 09 '15 at 00:34
  • Yes I have but I didn't understand what to do. Since I upgraded to ADT 1.0, my libs folder seeem to have disappeared from the project tree but yet it's seems to be still working. – Grégoire Borel Jan 09 '15 at 00:49
  • Above the tree you have in your screenshot is a drop-down list. If that shows "Android", switch it to "Project", to get a filesystem look at your project contents. – CommonsWare Jan 09 '15 at 00:51
  • post your build.gradle file – bjiang Jan 09 '15 at 01:06
  • Try removing `compile 'com.android.support:support-v4:19.0.0'` from your depenceny? If you can a look at [their build.gradle](https://github.com/flavienlaurent/datetimepicker/blob/master/datetimepicker-library/build.gradle), they have already compiled support v4 which now has conflict with your version. – Lawrence Choy Jan 09 '15 at 02:02

1 Answers1

0

Your build file misses repositories block. The dependency is in JCenter, so just add

repositories {
    jcenter()
}

That should do it.

JBaruch
  • 22,610
  • 5
  • 62
  • 90