Code_Yoga
Code_Yoga

Reputation: 3248

Unable to add Gradle Dependency

I am trying to add this dependency to gradle, but I am receiving the below errors about other dependencies which I have not added in the first Place.

Errors :

enter image description here

Dependency I am trying to add is com.wdullaer:materialdatetimepicker:3.1.3

build.gradle file

apply plugin: 'com.android.application'

android {
    compileSdkVersion 24
    buildToolsVersion "25.0.2"
    defaultConfig {
        applicationId "com.pf.datetimepicker"
        minSdkVersion 21
        targetSdkVersion 24
        versionCode 1
        versionName "1.0"
        testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
    }
    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
    }
}

dependencies {
    compile fileTree(dir: 'libs', include: ['*.jar'])
    compile 'com.android.support:appcompat-v7:+'
    compile 'com.wdullaer:materialdatetimepicker:3.1.3'
}

Upvotes: 0

Views: 496

Answers (4)

MarcGV
MarcGV

Reputation: 1262

Change your compileSdkVersion, buildToolsVersion andtargetSdkVersion

apply plugin: 'com.android.application'

android {
    compileSdkVersion 25
    buildToolsVersion "25.0.2"
    defaultConfig {
        applicationId "com.pf.datetimepicker"
        minSdkVersion 21
        targetSdkVersion 25
        versionCode 1
        versionName "1.0"
        testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
    }
    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
    }
}

dependencies {
    compile fileTree(dir: 'libs', include: ['*.jar'])
    compile 'com.android.support:appcompat-v7:+'
    compile 'com.wdullaer:materialdatetimepicker:3.1.3'
}

Upvotes: 1

OneCricketeer
OneCricketeer

Reputation: 191681

which I have not added in the first Place.

Sure you did...

Look at the source of the library you got. https://github.com/wdullaer/MaterialDateTimePicker/blob/master/library/build.gradle

compile 'com.android.support:support-v4:25.2.0'
compile 'com.android.support:support-v13:25.2.0'
compile 'com.android.support:design:25.2.0'

First, you need compileSdkVersion 25 for those to even work, then you need to allow Android Studio to "Install Repository and Sync Project" or do it yourself by updating the SDK Manager.

Upvotes: 1

Tuyen Nguyen
Tuyen Nguyen

Reputation: 19

You have not installed the newest version of android support libraries. Just open SDK manager and install them. See the image

Upvotes: 0

Krishna Meena
Krishna Meena

Reputation: 6351

Change your compile and targetsdk to 25

Upvotes: 1

Related Questions