Shayan ebrahimzadeh
Shayan ebrahimzadeh

Reputation: 15

cant import some libraries in android studio

I am trying to import some libraries like Picasso, etc. but Android Studio shows up with this message.

enter image description here

here is the build.gradle(Module:app)

apply plugin: 'com.android.application'

android {
compileSdkVersion 25
buildToolsVersion "25.0.3"
defaultConfig {
    applicationId "com.example.mypc.urumcafe"
    minSdkVersion 17
    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(include: ['*.jar'], dir: 'libs')
androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', 
{
    exclude group: 'com.android.support', module: 'support-annotations'
})
compile 'com.android.support:appcompat-v7:25.3.1'
compile 'com.android.support.constraint:constraint-layout:1.0.0-alpha7'
compile 'com.android.volley:volley:1.0.0'
compile 'com.amitshekhar.android:android-networking:1.0.1'
compile 'com.android.support:design:25.3.1'
testCompile 'junit:junit:4.12'
}

I just want to import 'com.amitshekhar.android:android-networking:1.0.1'but as you can see in the uploaded image there is "failed to resolve" error. so how can I fix this? the same story is for Picasso lib. Thank you.

Upvotes: 0

Views: 1388

Answers (3)

Martin Zeitler
Martin Zeitler

Reputation: 76569

you might be lacking the Maven Central (or the jitpack.io for v1.0.2) repository:

allprojects {
    repositories {
        google()
        mavenCentral()
        jcenter() 
    }
}

Upvotes: 0

Anubhav Gupta
Anubhav Gupta

Reputation: 2000

Update your build tools version to 27.0.3 and corresponding dependencies to sdk version 27.

here is the updated build.gradle and it is working perfectly.

apply plugin: 'com.android.application'

android {
    compileSdkVersion 27
    buildToolsVersion "27.0.3"
    defaultConfig {
        applicationId "com.example.mypc.urumcafe"
        minSdkVersion 17
        targetSdkVersion 27
        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(include: ['*.jar'], dir: 'libs')
    androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2',
            {
                exclude group: 'com.android.support', module: 'support-annotations'
            })
    compile 'com.android.support:appcompat-v7:27.1.1'
    compile 'com.android.support.constraint:constraint-layout:2.+'
    compile 'com.android.volley:volley:1.0.0'
    compile 'com.amitshekhar.android:android-networking:1.0.1'
    compile 'com.android.support:design:27.1.1'
    testCompile 'junit:junit:4.12'
}

Upvotes: 1

Matin Gdz
Matin Gdz

Reputation: 217

The newest version of the library is 1.0.2. Use this and try again:

com.amitshekhar.android:android-networking:1.0.2

Upvotes: 0

Related Questions