gpt4 book ai didi

android - Gradle 找不到库

转载 作者:行者123 更新时间:2023-11-29 00:11:54 27 4
gpt4 key购买 nike

我正在使用 android studio。具有以下依赖关系。 Gradle 找不到第三方库 volley 和 square 但确实找到了 appcompat:

compile 'com.android.support:appcompat-v7:21.0.3'
compile 'com.mcxiaoke.volley:library:1.0.+@aar'
compile 'com.squareup.phrase:phrase:1.0.3'

.

Error:Failed to find: com.mcxiaoke.volley:library:1.0.+

我已经更新了 Android SDK 管理器工具和 Extras,包括支持库,但仍然没有成功。我已经尝试过使用 jcenter() 和 mavenCentral()。谁能帮忙?

build.gradle:

// Top-level build file where you can add configuration options common to all sub-projects/modules.

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

// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}

allprojects {
repositories {
jcenter()
}
dependencies{

}
}

app/build.gradle:

apply plugin: 'com.android.application'

android {
compileSdkVersion 21
buildToolsVersion "21.1.2"

defaultConfig {
applicationId "com.example.tap"
minSdkVersion 8
targetSdkVersion 21
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:21.0.3'
compile 'com.mcxiaoke.volley:library:1.0.+@aar'
compile 'com.squareup.phrase:phrase:1.0.3'
}

settings.gradle:

include ':app'

最佳答案

你需要从

compile 'com.mcxiaoke.volley:library:1.0.+@aar' 

 compile 'com.mcxiaoke.volley:library:1.0.+'

& 在存储库部分包含 mavenCentral()。 在您的 app/build.gradle 中,在发布部分之后的存储库部分添加 mavenCentral()。

Note - Google doesn’t provide a build of Volley for Gradle but there are mirrored copies of Volley published for use in Gradle.

参见 Unofficial mirror for android-volley library here .

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

并更改您的依赖项部分以使其看起来相似:

dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
compile 'com.android.support:appcompat-v7:21.0.3'
compile 'com.mcxiaoke.volley:library:1.0.+'
compile 'com.squareup.phrase:phrase:1.0.3'

关于android - Gradle 找不到库,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/29626177/

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com