android - 使用Gradle将Unirest添加到Android Studio

标签 android android-studio gradle dependency-management unirest

我知道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.

我不知道它是否会引起问题,所以请有人能解释一下如何在我的Android Studio项目中逐步加入Unirest吗?非常感谢你。

最佳答案

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

而不是添加:

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

至:
buildscript {
    ...
    repositories {
        ...
    }
    ...
}

将其添加到:
allprojects {
    ...
    repositories {
        >HERE<
    }
    ...
}

关于android - 使用Gradle将Unirest添加到Android Studio,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/46868802/

相关文章:

android - 在最后一步使用 HoloEverywhere 时出错

android - 在 Android 上使用 Web 服务时出现异常错误

android - 获取照片引用

android - 合并 dex 文件时出错

android - Android Studio 中的 cordova-android@4.0.0 和 gradle 配置不起作用

android - 解决gradle问题时出错...错误:任务 ':app:transformDexArchiveWithExternalLibsDexMergerForDebug'的执行失败

gradle - 使用 Gradle 为 Intellij 15 定义测试源集

android - 如何返回 Activity 堆栈中某处的 Activity ?

android - 错误 :Execution failed for task ':app:buildInfoDebugLoader' in Android

android - 如果未在特定类中调用方法,则添加警告