Could not resolve / Failed to resolve - com.amitshekhar.android:android-networking:1.0.2

i am trying to import network library , but android studio shows up with this meessage:ERROR: Unable to resolve dependency for ':app@debug/compileClasspath': Could not resolve com.amitshekhar.android:android-networking:1.0.2.

here is the build.gradle:

    apply plugin: 'com.android.application'

android {
    compileSdkVersion 28
    buildToolsVersion "29.0.3"
    defaultConfig {
        applicationId "com.example.myfaild"
        minSdkVersion 16
        targetSdkVersion 28
        versionCode 1
        versionName "1.0"
        testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
    }
    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
        }
    }
}

dependencies {
    implementation fileTree(dir: 'libs', include: ['*.jar'])
    implementation 'com.android.support:appcompat-v7:28.0.0'
    implementation 'com.android.support.constraint:constraint-layout:1.1.3'
    implementation 'com.android.support:design:28.0.0'
    implementation 'com.android.support:cardview-v7:28.0.0'
    implementation 'androidx.annotation:annotation:1.1.0'
    implementation 'com.android.support:support-v4:28.0.0'
    implementation 'com.amitshekhar.android:android-networking:1.0.2'
    androidTestImplementation 'com.android.support.test:runner:1.0.2'
    androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.2'
}

when I import it into activity.java like below

Code:

import com.androidnetworking.AndroidNetworking;
import com.androidnetworking.common.Priority;
import com.androidnetworking.error.ANError;
import com.androidnetworking.interfaces.JSONArrayRequestListener;

there are some errors

1) Cannot resolve symbol 'androidnetworking'
2) Cannot resolve symbol 'AndroidNetworking'
3) Cannot resolve symbol 'Priority'
4) Cannot resolve symbol 'JSONObjectRequestListener'
5) Cannot resolve symbol 'ANError'

Upvotes: 3

Views: 4528

Answers (3)

Imran Ahmed
Imran Ahmed

Reputation: 21

I think I may have found the solution for the same you have write this in your settings.gradle file maven { url ("https://jcenter.bintray.com") }

below the mavenCentral() line and make sure to add the above code to both the places as there you can see two mavenCentral() line in that file

and add the below line in your gradle.properties android.enableJetifier=true

Upvotes: 2

Abbas Gawali
Abbas Gawali

Reputation: 11

just add this code in your gradle file (settings.gradle.kts) in both the places:

 maven { url = uri("https://jcenter.bintray.com") }

it should look like this :

 pluginManagement {
    repositories {
        google()
        mavenCentral()
        maven { url = uri("https://jcenter.bintray.com") }
        gradlePluginPortal()
    }
}
dependencyResolutionManagement {
    repositoriesMode.set(RepositoriesMode.FAIL_ON_PROJECT_REPOS)
    repositories {
        google()
        mavenCentral()
        maven { url = uri("https://jcenter.bintray.com") }
    }
}

rootProject.name = "json data parsing"
include(":app")

Upvotes: 1

sergpetrov
sergpetrov

Reputation: 1714

The library is old and wasn't migrated to the Maven Central repository, since JCenter was deprecated.

You need to use it from Jitpack repository:

  1. Add it in your root build.gradle at the end of repositories:
allprojects {
    repositories {
        ...
        maven { url 'https://jitpack.io' }
    }
}
  1. Add the dependency to your app build.gradle:
dependencies {
    implementation 'com.github.amitshekhariitbhu.Fast-Android-Networking:android-networking:v1.0.2'
}

Enjoy!

Upvotes: 5

Related Questions