英文:
Failed to resolve: com.android.support:support-v4:30.0.0
问题
It Shows:
无法解析: com.android.support:support-v4:30.0.0
添加 Google Maven 仓库并同步项目
在项目结构对话框中显示
受影响的模块: app
build.gradle(:app):
apply plugin: 'com.android.application'
android {
compileSdkVersion 30
buildToolsVersion '30.0.2'
defaultConfig {
applicationId "com.example.android.miwok"
minSdkVersion 15
targetSdkVersion 30
versionCode 1
versionName "1.0"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
testImplementation 'junit:junit:4.12'
implementation 'com.android.support:appcompat-v7:30.0.0'
implementation 'com.android.support:support-v4:30.0.0'
implementation 'com.android.support:design:30.0.0'
}
英文:
It Shows:
Failed to resolve: com.android.support:support-v4:30.0.0
Add Google Maven repository and sync project
Show in Project Structure dialog
Affected Modules: app
build.gradle(:app):
apply plugin: 'com.android.application'
android {
compileSdkVersion 30
buildToolsVersion '30.0.2'
defaultConfig {
applicationId "com.example.android.miwok"
minSdkVersion 15
targetSdkVersion 30
versionCode 1
versionName "1.0"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
testImplementation 'junit:junit:4.12'
implementation 'com.android.support:appcompat-v7:30.0.0'
implementation 'com.android.support:support-v4:30.0.0'
implementation 'com.android.support:design:30.0.0'
}
答案1
得分: 3
使用androidx
库,大多数情况下现在需要使用它:
如果项目尚未迁移到Androidx
,您需要将Androidx
支持添加到您的项目中。
您可以在此处找到有关如何将项目迁移到Androidx的信息。
implementation 'androidx.appcompat:appcompat:1.2.0'
或者继续使用最新的support库
:
implementation 'com.android.support:appcompat-v7:28.0.0'
这是因为您正在尝试使用的support库
不存在。
要添加Google Maven存储库
和google()
,请在位于应用程序目录之外的build.gradle
文件中执行以下操作:
allprojects {
repositories {
google()
maven {
url 'https://maven.google.com'
}
jcenter()
}
}
英文:
Use the androidx
library mostly you need to use this now:
To use this you need to add Androidx
support to your project if it is not migrated to Androidx
.
You can find here how to migrate project to Androidx.
implementation 'androidx.appcompat:appcompat:1.2.0'
or use the last support library
:
implementation 'com.android.support:appcompat-v7:28.0.0'
It is because the support libraries
you trying to use don't exist.
For Add Google Maven repository
and google()
do this inside build.gradle
which outside of app directory.
allprojects {
repositories {
google()
maven {
url 'https://maven.google.com'
}
jcenter()
}
}
答案2
得分: 0
支持库 v30 **不存在**。
移除它们。
使用 [androidx 库][1]:
implementation 'androidx.appcompat:appcompat:1.2.0'
implementation 'androidx.legacy:legacy-support-v4:1.0.0'
implementation 'com.google.android.material:material:1.2.1'
要使用它们,您需要在顶层的 `build.gradle` 文件中添加 `google()` 仓库:
allprojects {
repositories {
google()
jcenter()
}
}
[1]: https://developer.android.com/jetpack/androidx/migrate/artifact-mappings
英文:
The support libraries v30 don't exist.
Remove them.
Use the androidx libraries:
implementation 'androidx.appcompat:appcompat:1.2.0'
implementation 'androidx.legacy:legacy-support-v4:1.0.0'
implementation 'com.google.android.material:material:1.2.1'
To use them you have to add the google()
repo in your top-level build.gradle
file:
allprojects {
repositories {
google()
jcenter()
}
}
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论