gpt4 book ai didi

android - 无法解析 ':app@debug/compileClasspath' 的依赖关系

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

我有一个 android 项目,我使用 android studio 2.3 开发它之后我将 android studio 更新到 3.3 并用新版本打开这个项目但是有很多错误解决了很多但有新错误所以这是我的应用程序 build.gradle:

apply plugin: 'com.android.application'

android {
compileSdkVersion 26
buildToolsVersion "27.0.3"
defaultConfig {
applicationId ""
minSdkVersion 16
targetSdkVersion 26
versionCode 1
versionName "1.0"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
aaptOptions {
cruncherEnabled = false
}
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}

dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
androidTestImplementation('com.android.support.test.espresso:espresso-core:2.2.2', {
exclude group: 'com.android.support', module: 'support-annotations'
})

implementation 'com.android.support:appcompat-v7:26.1.0'
implementation 'com.android.support:design:26.1.0'
implementation 'com.android.support.constraint:constraint-layout:1.0.2'
implementation 'com.android.support:cardview-v7:26.1.0'
implementation 'com.android.support:recyclerview-v7:26.1.0'
implementation 'com.squareup.picasso:picasso:2.5.2'
implementation 'com.jakewharton:butterknife:8.8.1'
implementation 'com.roughike:bottom-bar:2.0.2'
implementation 'com.android.support:palette-v7:26.1.0'
implementation 'com.android.support:support-v4:26.1.0'
implementation 'com.google.android.exoplayer:exoplayer:r2.3.1'
testImplementation 'junit:junit:4.12'
annotationProcessor 'com.jakewharton:butterknife-compiler:8.8.1'
implementation 'com.android.support:support-core-utils:26.1.0'
}

这是我的项目build.gradle:

buildscript {
repositories {
jcenter()
mavenCentral()
maven {
url "https://maven.google.com"
}
}
dependencies {
classpath 'com.android.tools.build:gradle:3.3.0-alpha02'
}
}

allprojects {
repositories {
jcenter()
mavenCentral()
maven {
url "https://maven.google.com"
}
}
}

task clean(type: Delete) {
delete rootProject.buildDir
}

这是我的 gradle-wrapper-properties:

distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-4.8-all.zip

这是我得到的错误:

Unable to resolve dependency for ':app@debug/compileClasspath': Could not resolve com.android.support:appcompat-v7:26.1.0.
Open File
Show Details

Unable to resolve dependency for ':app@debug/compileClasspath': Could not resolve com.android.support:design:26.1.0.
Open File
Show Details

Unable to resolve dependency for ':app@debug/compileClasspath': Could not resolve com.android.support:cardview-v7:26.1.0.
Open File
Show Details

Unable to resolve dependency for ':app@debug/compileClasspath': Could not resolve com.android.support:recyclerview-v7:26.1.0.
Open File
Show Details

Unable to resolve dependency for ':app@debug/compileClasspath': Could not resolve com.roughike:bottom-bar:2.0.2.
Open File
Show Details

Unable to resolve dependency for ':app@debug/compileClasspath': Could not resolve com.android.support:palette-v7:26.1.0.
Open File
Show Details

Unable to resolve dependency for ':app@debug/compileClasspath': Could not resolve com.android.support:support-v4:26.1.0.
Open File
Show Details

............等等

我正在尝试将所有依赖项和目标 sdk 的 26.0.1 从 26 更改为 27 和 27.1.1,但我遇到了同样的错误

我已经使用了代理,所以这是我的 gradle.properties:

systemProp.http.proxyHost=ip
systemProp.http.proxyPort=port
systemProp.http.proxyUser=user
systemProp.http.proxyPassword=pass

systemProp.https.proxyHost=ip
systemProp.https.proxyPort=port
systemProp.https.proxyUser=user
systemProp.https.proxyPassword=pass

并通过使用手动代理配置设置 > HTTP 代理

当我将 google() 添加到 gradle 时,错误更改为:

Could not resolve all dependencies for configuration ':app:debugRuntimeClasspath'.
Could not determine artifacts for com.android.support:support-core-utils:27.1.1
Could not get resource 'https://dl.google.com/dl/android/maven2/com/android/support/support-core-utils/27.1.1/support-core-utils-27.1.1.aar'.
Could not HEAD 'https://dl.google.com/dl/android/maven2/com/android/support/support-core-utils/27.1.1/support-core-utils-27.1.1.aar'. Received status code 407 from server: Proxy Authentication Required

所以我只删除了 google()有什么问题吗?

最佳答案

您还没有在根 build.gradle 中包含 google() 存储库。

buildscript {
repositories {
google()
jcenter()
mavenCentral()
maven {
url "https://maven.google.com"
}
}
dependencies {
classpath 'com.android.tools.build:gradle:3.3.0-alpha02'
}
}

allprojects {
repositories {
google()
jcenter()
mavenCentral()
maven {
url "https://maven.google.com"
}
}
}



task clean(type: Delete) {
delete rootProject.buildDir
}

关于android - 无法解析 ':app@debug/compileClasspath' 的依赖关系,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/51467692/

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