Dhaval
Dhaval

Reputation: 2874

Failed to resolve library in android studio

I am trying to add a third party library in gradle. It is showing following error:

enter image description here

Here is my gradle file :

apply plugin: 'com.android.application'

android {
    compileSdkVersion 23
    buildToolsVersion "23.0.2"
    compileOptions.encoding = 'ISO-8859-1'
    defaultConfig {
        applicationId "com.attendme.io"
        minSdkVersion 15
        targetSdkVersion 22
        versionCode 1
        versionName "1.4" //1.4.1
        //multiDexEnabled true
    }
    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
    }
}

dependencies {
    compile fileTree(include: ['*.jar'], dir: 'libs')
    testCompile 'junit:junit:4.12'
    compile files('libs/kandy-1.6.160.jar')
    compile files('libs/gcm.jar')
    compile 'com.android.support:appcompat-v7:23.3.0'
    compile 'com.android.support:design:23.3.0'
    compile 'com.android.support:recyclerview-v7:23.3.0'
    //compile 'com.google.android.gms:play-services-gcm:8.4.0'
    //compile 'com.google.android.gms:play-services-maps:8.4.0'
    compile 'com.squareup.okhttp3:okhttp:3.2.0'
    compile 'com.squareup.picasso:picasso:2.5.2'
    compile 'com.google.android.gms:play-services:8.4.0'
    compile 'com.github.ParkSangGwon:TedPicker:v1.0.10'


}

When I was searching about this problem I found some solutions but they weren't working for me. How can I fix this issue ?

Upvotes: 5

Views: 4569

Answers (3)

Muhammad Waleed
Muhammad Waleed

Reputation: 2601

We will use cwac-camera for take a picture. And get library from enter link jitpack.io

repositories {
    jcenter()
    maven { url "https://repo.commonsware.com.s3.amazonaws.com" }
    maven { url "https://jitpack.io" }

}

dependencies {
      compile 'com.github.ParkSangGwon:TedPicker:v1.0.10'
}

Add permission for Camera, External Storage,Also Runtime permission for android6. For more information read offical documentation

<uses-feature android:name="android.hardware.camera" />
<uses-feature android:name="android.hardware.camera.autofocus" android:required="false" />

<uses-permission android:name="android.permission.CAMERA" />
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />

Upvotes: 1

Tim
Tim

Reputation: 43304

You need to add 2 maven repositories.

So make sure your build.gradle(Project) includes this

allprojects {
    repositories {
        jcenter()
        maven { url "https://repo.commonsware.com.s3.amazonaws.com" }
        maven { url "https://jitpack.io" }
    }
}

and this goes in your build.gradle(app)

compile 'com.github.ParkSangGwon:TedPicker:v1.0.10'

Upvotes: 8

Mustafa Berkay Mutlu
Mustafa Berkay Mutlu

Reputation: 2099

You should also add repositories to your build.gradle. Put those repositories in your repositories tag. Put those above the android tag.

repositories {
    maven { url "https://repo.commonsware.com.s3.amazonaws.com" }
    maven { url "https://jitpack.io" }

}

Upvotes: 1

Related Questions