【发布时间】:2023-03-16 00:40:01
【问题描述】:
我在 Android Studio 中遇到了这个问题。
Error:Failed to resolve: com.android.support:appcompat-v7:27.+
<a href="install.m2.repo">Install Repository and sync project</a><br><a href="open.dependency.in.project.structure">Show in Project Structure
dialog</a>
我的 Android Studio 充满错误 android studio 无法识别库。整个画面是这样的。
这是我的Gradle 代码:
apply plugin: 'com.android.application'
android {
compileSdkVersion 27
buildToolsVersion "27.0.1"
defaultConfig {
applicationId "com.example.hp.temp"
minSdkVersion 21
targetSdkVersion 27
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:27.+'
}
【问题讨论】:
-
您是否尝试过安装存储库和同步项目?
-
如果你住在伊朗等一些国家,很遗憾google不支持你的gradle,所以你必须使用vpn来获取gradle依赖。
-
实际上这个答案不应该被标记为重复,因为解决方案的技术要求与源答案不同。
-
在项目 build.gradle 的 jcenter() 之后添加 maven { url "maven.google.com" }
标签: android android-studio android-gradle-plugin