我正在使用 android studio,当我尝试添加依赖项时
compile 'com.loopj.android:android-async-http:1.4.9'
同步项目时出现错误
错误:找不到:com.loopj.android:android-async-http:1.4.9
打开文件
在“项目结构”对话框中打开
当我打开项目结构 -> 依赖项时,它显示在库下 但问题是库没有同步。
当我尝试清理项目时,出现如下错误
Error:A problem occurred configuring root project 'Frendy'.
Could not resolve all dependencies for configuration ':_debugCompile'. Could not find com.loopj.android:android-async-http:1.4.9. Searched in the following locations: file:/C:/Users/Binil/AppData/Local/Android/sdk/extras/android/m2repository/com/loopj/android/android-async-http/1.4.9/android-async-http-1.4.9.pom file:/C:/Users/Binil/AppData/Local/Android/sdk/extras/android/m2repository/com/loopj/android/android-async-http/1.4.9/android-async-http-1.4.9.jar file:/C:/Users/Binil/AppData/Local/Android/sdk/extras/google/m2repository/com/loopj/android/android-async-http/1.4.9/android-async-http-1.4.9.pom file:/C:/Users/Binil/AppData/Local/Android/sdk/extras/google/m2repository/com/loopj/android/android-async-http/1.4.9/android-async-http-1.4.9.jar Required by: :Frendy:unspecified
谁能帮帮我吗?
最佳答案
添加 Maven 存储库,它应该可以工作,其描述见 https://github.com/loopj/android-async-http在 gradle 部分
这是我的 gradle 示例:
apply plugin: 'com.android.application'
repositories {
maven {
url 'https://repo1.maven.org/maven2/'
}
}
android {
compileSdkVersion 23
buildToolsVersion "23.0.1"
defaultConfig {
applicationId "com.mine.android"
minSdkVersion 10
targetSdkVersion 23
versionCode 1
versionName "1.0"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
} }
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
compile 'com.android.support:appcompat-v7:23.1.1'
compile 'com.loopj.android:android-async-http:1.4.9'
}
}
关于Android:loopj 未导入,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/35886391/