AndroidStudio同步的gradle:未能解决 [英] AndroidStudio gradle sync : failed to resolve

查看:570
本文介绍了AndroidStudio同步的gradle:未能解决的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有新的明确的Andr​​oid应用程序。我想补充的抽射,以我的应用程序进行HTTP请求。我使用的摇篮开发的应用程序与Android工作室。下面是截图我的应用程序:

您看,我要凌空添加到我的应用程序加入这一行code的驴 com.mcxiaoke.volley:库AAR:1.0.0 到的build.gradle文件

我试图添加改造了。但它给了相同类型的错误:无法解析:唧唧歪歪

所以我觉得在我的情况gradle这个不能同步任何其他库比com.android不同......

我试图增加code这行我也的build.gradle。但没有什么正在改变

  buildTypes {
    发布 {
        minifyEnabled假
        proguardFiles getDefaultProguardFile('proguard的-android.txt'),'proguard的-rules.txt
    }
    库{
        mavenCentral()
    }
}

请指教

编辑:后添加注释的build.gradle文件项目和模块。
项目:

  buildscript {
    库{
        jcenter()
    }
    依赖{
        类路径'com.android.tools.build:gradle:1.3.0
    }
}allprojects {
    库{
        jcenter()
    }
}

模块:

 应用插件:'com.android.application安卓{
    compileSdkVersion 23
    buildToolsVersion23.0.0    defaultConfig {
        的applicationIDdomain.testgradle
        11的minSdkVersion
        targetSdkVersion 23
        版本code 1
        的versionName1.0
    }
    buildTypes {
        发布 {
            minifyEnabled假
            proguardFiles getDefaultProguardFile('proguard的-android.txt'),'proguard-rules.pro
        }
    }
}依赖{
    编译文件树(导演:'库',包括:['的* .jar'])
    编译com.android.support:appcompat-v7:23.0.1
    编译com.mcxiaoke.volley:库:1.0.19
}


解决方案

凌空现在由上jCenter Android开源项目发布的:

  {相关性
    编译com.android.volley:凌空:1.0.0
}

I have new clear android app. I want to add volley to my app to make HTTP request. I am developing app with Android studio using Gradle. Here is screenshot for my app:

Ass you see i am going to add volley to my app adding this line of code com.mcxiaoke.volley:library-aar:1.0.0 to build.gradle file

I tried to add Retrofit too. But it gives same type of error: Failed to resolve: bla bla bla.

So i think in my situation gradle can not sync any other library different than com.android......

And i have tried add this lines of code to my build.gradle too. but nothing is changing

 buildTypes {
    release {
        minifyEnabled false
        proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.txt'
    }
    repositories {
        mavenCentral()
    }
}

Please advise

Edit: After comments added build.gradle files for project and for module. Project:

buildscript {
    repositories {
        jcenter()
    }
    dependencies {
        classpath 'com.android.tools.build:gradle:1.3.0'
    }
}

allprojects {
    repositories {
        jcenter()
    }
}

Module:

apply plugin: 'com.android.application'

android {
    compileSdkVersion 23
    buildToolsVersion "23.0.0"

    defaultConfig {
        applicationId "domain.testgradle"
        minSdkVersion 11
        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.0.1'
    compile 'com.mcxiaoke.volley:library:1.0.19'
}

解决方案

Volley is now published by the Android Open Source Project on jCenter:

dependencies {
    compile 'com.android.volley:volley:1.0.0'
}

这篇关于AndroidStudio同步的gradle:未能解决的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆