使用 Gradle 将 Unirest 添加到 Android Studio

Add Unirest to Android Studio with Gradle

我知道 Unirest 可能被认为不太好,但我非常需要它来使用一些 API。

因为我正在使用 Gradle,所以我无法按照有关 Maven 的指南将其包含在我的 Android Studio 项目中,我只发现了以下内容:

repositories {
        ...
        maven{
            url 'https://raw.github.com/zeeshanejaz/unirest-android/mvn-repo'
        }
    }
...
dependencies {
    ...
    compile 'com.mashape.unirest:unirest-android:1.0+'
}

然而结果如下:

Warning:WARNING: Dependency org.apache.httpcomponents:httpclient:4.3.6 is ignored for debug as it may be conflicting with the internal version provided by Android.
Warning:WARNING: Dependency commons-logging:commons-logging:1.1.3 is ignored for debug as it may be conflicting with the internal version provided by Android.
Warning:WARNING: Dependency org.apache.httpcomponents:httpclient:4.3.6 is ignored for debug as it may be conflicting with the internal version provided by Android.
Warning:WARNING: Dependency org.json:json:20140107 is ignored for debug as it may be conflicting with the internal version provided by Android.
Warning:WARNING: Dependency org.apache.httpcomponents:httpclient:4.3.6 is ignored for debug as it may be conflicting with the internal version provided by Android.
Warning:WARNING: Dependency commons-logging:commons-logging:1.1.3 is ignored for debug as it may be conflicting with the internal version provided by Android.
Warning:WARNING: Dependency org.apache.httpcomponents:httpclient:4.3.6 is ignored for debug as it may be conflicting with the internal version provided by Android.
Warning:WARNING: Dependency org.json:json:20140107 is ignored for debug as it may be conflicting with the internal version provided by Android.
Warning:WARNING: Dependency org.apache.httpcomponents:httpclient:4.3.6 is ignored for release as it may be conflicting with the internal version provided by Android.
Warning:WARNING: Dependency commons-logging:commons-logging:1.1.3 is ignored for release as it may be conflicting with the internal version provided by Android.
Warning:WARNING: Dependency org.apache.httpcomponents:httpclient:4.3.6 is ignored for release as it may be conflicting with the internal version provided by Android.
Warning:WARNING: Dependency org.json:json:20140107 is ignored for release as it may be conflicting with the internal version provided by Android.
Warning:WARNING: Dependency org.apache.httpcomponents:httpclient:4.3.6 is ignored for release as it may be conflicting with the internal version provided by Android.
Warning:WARNING: Dependency commons-logging:commons-logging:1.1.3 is ignored for release as it may be conflicting with the internal version provided by Android.
Warning:WARNING: Dependency org.apache.httpcomponents:httpclient:4.3.6 is ignored for release as it may be conflicting with the internal version provided by Android.
Warning:WARNING: Dependency org.json:json:20140107 is ignored for release as it may be conflicting with the internal version provided by Android.

我不知道它是否会导致问题,所以请有人能一步一步地向我解释如何将 Unirest 包含在我的 Android Studio 项目中吗?非常感谢。

刚遇到同样的问题,找到了解决方案:

而不是添加:

maven{
    url 'https://raw.github.com/zeeshanejaz/unirest-android/mvn-repo'
}

至:

buildscript {
    ...
    repositories {
        ...
    }
    ...
}

将其添加到:

allprojects {
    ...
    repositories {
        >HERE<
    }
    ...
}