我正在尝试导入网络库,但是android显示了这样的方法:ERROR:无法解决‘:app@debug/编译程序compileClasspath’的依赖关系:无法解析com.amitshekhar.android:android-networking:1.0.2.
下面是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'
}
当我将它导入到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'
发布于 2022-08-11 19:12:40
这个库是旧的,没有迁移到Maven中央存储库,因为不推荐使用JCenter。
您需要从Jitpack储存库中使用它
allprojects {
repositories {
...
maven { url 'https://jitpack.io' }
}
}
dependencies {
implementation 'com.github.amitshekhariitbhu.Fast-Android-Networking:android-networking:v1.0.2'
}
享受吧!
https://stackoverflow.com/questions/73306521
复制相似问题