Android:loopj 未导入

标签 android http-headers httpclient build.gradle

我正在使用 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/

相关文章:

php - 从 PHP 创建、显示图像

c# - 使用 HttpWebRequest 收到的截断响应

Android 数据绑定(bind) @{} 与 @={}

android - 如何修复:android.app.RemoteServiceException:从程序包中发布的错误通知*:无法创建图标:StatusBarIcon

Android Branch IO 深度链接无法打开我的应用程序

ios - 如何正确使用 HTTP 正文进行发布?

java - 如何从服务器端 Controller 返回或调用签名的小程序的方法?

c# - 使用 PostAsync、HttpClient 和 Json 从 C# Metro UI 客户端调用 MVC4 WebAPI 方法

android - Web服务SocketTimeOutException导致数据库不一致

android - 调用Asynctask调用webservice后如何更新listview