Android studio 无法解析';的依赖关系:app@debug/compileClasspath';:无法解析com.android。支持:appcompat-v7:28.0.0-rc01
我在新的Android studio版本中发现了以下错误:基本的hello world也没有在gradle中构建。云也请你帮忙 这是我在新的android studio版本中遇到的错误: 我的梯度文件如下所示Android studio 无法解析';的依赖关系:app@debug/compileClasspath';:无法解析com.android。支持:appcompat-v7:28.0.0-rc01,android-studio,Android Studio,我在新的Android studio版本中发现了以下错误:基本的hello world也没有在gradle中构建。云也请你帮忙 这是我在新的android studio版本中遇到的错误: 我的梯度文件如下所示 apply plugin: 'com.android.application' android { compileSdkVersion 28 defaultConfig { applicationId "payments.com.java.payment
apply plugin: 'com.android.application'
android {
compileSdkVersion 28
defaultConfig {
applicationId "payments.com.java.payments"
minSdkVersion 17
targetSdkVersion 28
versionCode 1
versionName "1.0"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation 'com.android.support:appcompat-v7:28.0.0-rc01'
implementation 'com.android.support.constraint:constraint-layout:1.1.2'
testImplementation 'junit:junit:4.12'
androidTestImplementation 'com.android.support.test:runner:1.0.2'
androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.2'
}
这是我得到的日志
apply plugin: 'com.android.application'
android {
compileSdkVersion 28
defaultConfig {
applicationId "payments.com.java.payments"
minSdkVersion 17
targetSdkVersion 28
versionCode 1
versionName "1.0"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation 'com.android.support:appcompat-v7:28.0.0-rc01'
implementation 'com.android.support.constraint:constraint-layout:1.1.2'
testImplementation 'junit:junit:4.12'
androidTestImplementation 'com.android.support.test:runner:1.0.2'
androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.2'
}
无法解析“”的依赖项:app@debug/compileClasspath':无法解析com.android。支持:appcompat-v7:28.0.0-rc01。 打开文件 显示细节
无法解析“”的依赖项:app@debug/compileClasspath':无法解析com.android.support。约束:约束布局:1.1.2。 打开文件 显示细节
无法解析“”的依赖项:app@debugAndroidTest/compileClasspath':无法解析com.android.support.test:runner:1.0.2。 打开文件 显示细节
无法解析“”的依赖项:app@debugAndroidTest/compileClasspath':无法解析com.android.support.test.espresso:espresso核心:3.0.2。 打开文件 显示细节
无法解析的依赖项 ':app@debugAndroidTest/compileClasspath':无法解析com.android。支持:appcompat-v7:28.0.0-rc01。 打开文件 显示细节
无法解析“”的依赖项:app@debugAndroidTest/compileClasspath':无法解析com.android.support。约束:约束布局:1.1.2。 打开文件 显示细节
无法解析“”的依赖项:app@debugUnitTest/compileClasspath':无法解析com.android。支持:appcompat-v7:28.0.0-rc01。 打开文件 显示细节
无法解析“”的依赖项:app@debugUnitTest/compileClasspath':无法解析com.android.support。约束:约束布局:1.1.2。 打开文件 显示细节
无法解析“”的依赖项:app@release/compileClasspath':无法解析com.android。支持:appcompat-v7:28.0.0-rc01。 打开文件 显示细节
无法解析“”的依赖项:app@release/compileClasspath':无法解析com.android.support。约束:约束布局:1.1.2。 打开文件 显示细节
无法解析“”的依赖项:app@releaseUnitTest/compileClasspath':无法解析com.android。支持:appcompat-v7:28.0.0-rc01。 打开文件 显示细节
无法解析“”的依赖项:app@releaseUnitTest/compileClasspath':无法解析com.android.support。约束:约束布局:1.1.2。 打开文件 显示细节
如果您有任何其他正在工作(非错误)的Android Studio项目 您可以检查
项目-应用程序下build.gradle
的设置,并查找以下行:
implementation 'com.android.support:appcompat-v7:***'
是您的工作项目中的工作SDK版本,然后替换
implementation 'com.android.support:appcompat-v7:28.0.0-rc01'
使用工作SDK版本(***)
如果您没有任何工作(没有错误)项目,可以尝试我的:
implementation 'com.android.support:appcompat-v7:28.0.0-alpha3'
希望这能解决你的问题,因为它刚刚解决了我的问题。请参考我创建的Youtube视频,作为这个问题的解决方案
这就是你的Gradle的样子
apply plugin: 'com.android.application'
android {
compileSdkVersion 27
defaultConfig {
applicationId "payments.banamex.citi.com.banamexpayments"
minSdkVersion 17
targetSdkVersion 27
versionCode 1
versionName "1.0"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation 'com.android.support:appcompat-v7:27.1.1'
implementation 'com.android.support.constraint:constraint-layout:1.1.2'
testImplementation 'junit:junit:4.12'
androidTestImplementation 'com.android.support.test:runner:1.0.2'
androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.2'
}
使用:
implementation'com.android.support:appcompat-v7:28.+'
+
将匹配appcompat-v7:28的任何版本。目前,存储库中有28.0.0-alpha1和28.0.0-alpha3
。如果已选中脱机模式,则需要禁用该模式。文件>设置>构建、执行和部署>渐变-取消选中脱机模式并应用
另外,请检查您的互联网连接。我在中国使用Shadowsocks
代理,打开~/.gradle/gradle.properties
并评论https主机和端口
#systemProp.https.proxyPort=1080
systemProp.http.proxyHost=127.0.0.1
#systemProp.https.proxyHost=127.0.0.1
systemProp.http.proxyPort=1080
在那之后,重新创建新项目或重新构建您的项目,完成了我遇到了同样的错误。我找到了解决方案。我希望它也能帮助您
转到build.gradle(模块:app)和删除
implementation 'com.android.support:design:28.0.0-rc01'
试试这个:
删除gradle http代理
C:\Users***.gradle\gradle.properties
如果不支持28版本,则意味着将符合要求的目标版本更改为27检查您的internet连接。对我来说,这只是互联网连接问题。如果您在代理服务器下。转到文件>设置>外观和行为>系统设置>HTTP代理,然后在那里输入代理详细信息。使用“检查连接”选项验证您的连接。这是我的gradle文件的参考
apply plugin: 'com.android.application'
android {
compileSdkVersion 28
defaultConfig {
applicationId "com.oops.pk.birthday_card"
minSdkVersion 23
targetSdkVersion 28
versionCode 1
versionName "1.0"
testInstrumentationRunner
"android.support.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'),
'proguard-rules.pro'
}
}
}
dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation 'com.android.support:appcompat-v7:28.0.0-rc02'
implementation 'com.android.support:support-v4:28.0.0'
implementation 'com.android.support:recyclerview-v7:28.0.0'
implementation 'com.android.support:design:28.0.0'
testImplementation 'junit:junit:4.12'
androidTestImplementation 'com.android.support.test:runner:1.0.2'
androidTestImplementation 'com.android.support.test.espresso:espresso-
core:3.0.2'
}
我的同事也遇到了同样的问题。我们通过删除.android、.AndroidStudiox.x和.gradle文件夹来解决此问题。这将删除所有当前的android设置,并在打开android studio时再次下载。确保android studio必须关闭
原因
如果您在中国,可能是因为您的Android Studio
没有正确设置代理。因此,在构建应用程序时,gradle
无法访问以下载依赖项(如支持库)
注意:androidstudio
是允许socks代理和http代理,但是gradle
是只允许http代理。因此,如果您在Android Studio中设置了socks代理,您可能会发现您的Android Studio
可以下载SDK,甚至可以升级。但是当您构建时,gradle
无法下载支持库,因为您现在正在使用socks代理
如何修复
如果使用Shadowsocks
proxy。遵循以下步骤:
- 对于Mac OS:
您不应该下载ShadowsocksX,因为ShadowsocksX可能与Android Studio不兼容。
而
ShadowsocksX NG
是使用socks5代理,Android Studio是访问socks5代理,但请记住gradle
没有
您可以在