Android Studio 无法解析/无法解析-com.amitshekhar.android:android-networking:1.0.2

yzckvree  于 2023-03-30  发布在  Android
关注(0)|答案(2)|浏览(212)

我试图导入网络库,但android studio显示此消息:错误:无法解析“:app@debug/compileClasspath”的依赖项:无法解析com.amitshekhar.android:android-networking:1.0.2。
这里是构建。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'
}

当我像下面这样将它导入到activity.java时
验证码:

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

有一些错误

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'
xjreopfe

xjreopfe1#

该库很旧,并且没有迁移到Maven Central存储库,因为JCenter已被弃用。
你需要从Jitpack仓库中使用它:
1.将其添加到存储库末尾的根build.gradle中:

allprojects {
    repositories {
        ...
        maven { url 'https://jitpack.io' }
    }
}

1.将依赖项添加到您的应用build.gradle:

dependencies {
    implementation 'com.github.amitshekhariitbhu.Fast-Android-Networking:android-networking:v1.0.2'
}

好好享受吧

jckbn6z7

jckbn6z72#

我想我可能已经找到了相同的解决方案,你已经在你的Setting.gradel文件maven { url ("https://jcenter.bintray.com") }中写了这个
mavenCentral()行下面,并确保将上述代码添加到这两个位置,因为您可以在该文件中看到两个mavenCentral()
并在您的gradel.propertiesandroid.enableJetifier=true中添加以下行

相关问题