本文介绍了AndroidStudio找不到Volley的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我从git clone https://android.googlesource.com/platform/frameworks/凌空并将其导入为AndroidStudio中的新模块,但同步时出现以下错误:

I cloned volley from git clone https://android.googlesource.com/platform/frameworks/volley and imported it as a new module in AndroidStudio, but I get the following error when syncing:

我的build.gradle,在我的应用程序文件夹中:

My build.gradle, in my app folder:

apply plugin: 'com.android.application'

android {
    compileSdkVersion 23
    buildToolsVersion "23.0.2"

    defaultConfig {
        applicationId "com.example.cs169_au.volleytest1"
        minSdkVersion 22
        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'])
    testCompile 'junit:junit:4.12'
    compile 'com.android.support:appcompat-v7:23.2.0'
    compile 'com.android.support:design:23.2.0'
    compile 'com.google.android.gms:play-services:8.1.0'
    compile 'com.android.support:support-v4:23.1.1'
    compile 'com.google.maps:google-maps-services:0.1.7'
    compile 'com.android.volley:volley.1.0.0'
}

repositories {
    mavenCentral()
}

推荐答案

Google的官方Volley托管在JCenter中,因此您必须在项目的 build.gradle 中将jcenter()添加到repositories中. :

Google's official Volley is hosted in JCenter, so you have to add jcenter() to repositories in the project's build.gradle:

allprojects {
    repositories {
        mavenCentral()
        jcenter() // Add this line
    }
}

这篇关于AndroidStudio找不到Volley的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

10-23 16:05