【问题标题】:I am trying to upgrade my gradle 28 SDK to 29 but its show me this error [duplicate]我正在尝试将我的 gradle 28 SDK 升级到 29,但它显示了这个错误 [重复]
【发布时间】:2019-08-07 12:28:13
【问题描述】:

升级 gradle 我的 sdk 时向我显示的错误是 28,但我想升级为 9+ 不支持的安卓版本。

>ERROR: Failed to resolve: com.android.support:appcompat-v7:28
Show in Project Structure dialog
Affected Modules: app


>ERROR: Failed to resolve: com.android.support:design:28
Show in Project Structure dialog
Affected Modules: app


>ERROR: Failed to resolve: com.android.support:cardview-v7:28
Show in Project Structure dialog
Affected Modules: app


>ERROR: Failed to resolve: com.android.support:palette-v7:28
Show in Project Structure dialog
Affected Modules: app


>ERROR: Failed to resolve: com.android.support:recyclerview-v7:28
Show in Project Structure dialog
Affected Modules: app


>ERROR: Failed to resolve: com.android.support:support-annotations:28
Show in Project Structure dialog
Affected Modules: app


>ERROR: Failed to resolve: com.android.support:exifinterface:28
Show in Project Structure dialog
Affected Modules: app


>ERROR: Failed to resolve: com.android.support:support-v4:28
Show in Project Structure dialog
Affected Modules: app


>ERROR: Failed to resolve: com.android.support:customtabs:28
Show in Project Structure dialog
Affected Modules: app


>ERROR: Failed to resolve: com.android.support:appcompat-v7:29.0.1
Show in Project Structure dialog
Affected Modules: app


>ERROR: Failed to resolve: com.android.support:design:29.0.1
Show in Project Structure dialog
Affected Modules: app


>ERROR: Failed to resolve: com.android.support:cardview-v7:29.0.1
Show in Project Structure dialog
Affected Modules: app


>ERROR: Failed to resolve: com.android.support:palette-v7:29.0.1
Show in Project Structure dialog
Affected Modules: app


>ERROR: Failed to resolve: com.android.support:recyclerview-v7:29.0.1

Show in Project Structure dialog
Affected Modules: app

分级

dependencies {
    implementation fileTree(include: ['*.jar'], dir: 'libs')
    testImplementation 'junit:junit:4.13-beta-3'
    implementation 'com.android.support:appcompat-v7:29.0.1'
    implementation 'com.android.support:design:29.0.1'
    implementation 'com.android.support:cardview-v7:29.0.1'
    implementation 'com.android.support:palette-v7:29.0.1'
    implementation 'com.android.support:recyclerview-v7:29.0.1'
    implementation 'com.balysv:material-ripple:1.0.2'
    implementation 'com.squareup.picasso:picasso:2.71828'
    implementation 'com.onesignal:OneSignal:3.11.2'
    implementation 'com.google.android.gms:play-services-ads:18.1.1'
    implementation 'com.google.firebase:firebase-core:17.0.1'
    implementation 'com.google.firebase:firebase-messaging:19.0.1'
    implementation 'com.google.android.ads.consent:consent-library:1.0.7'
}


android {
    compileSdkVersion 29
    buildToolsVersion "29.0.1"
    defaultConfig {


        minSdkVersion 16
        targetSdkVersion 29
        versionCode 1
        versionName "1.1"
        testInstrumentationRunner
        "android.support.test.runner.AndroidJUnitRunner"
    }

错误

>Failed to resolve: com.android.support:appcompat-v7:28
    <a href="open.dependency.in.project.structure">Show in Project Structure dialog</a>
    Affected Modules: <a href="openFile:E:/Software house/APPS/Building Apps/App 3 YourRecipesApp Online/App Model/Recipes Master/app/build.gradle">app</a> 
    Failed to resolve: com.android.support:design:28
    <a href="open.dependency.in.project.structure">Show in Project Structure dialog</a>
    Affected Modules: <a href="openFile:E:/Software house/APPS/Building Apps/App 3 YourRecipesApp Online/App Model/Recipes Master/app/build.gradle">app</a> 
    Failed to resolve: com.android.support:cardview-v7:28
    <a href="open.dependency.in.project.structure">Show in Project Structure dialog</a>
    Affected Modules: <a href="openFile:E:/Software house/APPS/Building Apps/App 3 YourRecipesApp Online/App Model/Recipes Master/app/build.gradle">app</a> 
    Failed to resolve: com.android.support:palette-v7:28
    <a href="open.dependency.in.project.structure">Show in Project Structure dialog</a>
    Affected Modules: <a href="openFile:E:/Software house/APPS/Building Apps/App 3 YourRecipesApp Online/App Model/Recipes Master/app/build.gradle">app</a> 
    Failed to resolve: com.android.support:recyclerview-v7:28
    <a href="open.dependency.in.project.structure">Show in Project Structure dialog</a>
    Affected Modules: <a href="openFile:E:/Software house/APPS/Building Apps/App 3 YourRecipesApp Online/App Model/Recipes Master/app/build.gradle">app</a> 
    Failed to resolve: com.android.support:support-annotations:28
    <a href="open.dependency.in.project.structure">Show in Project Structure dialog</a>
    Affected Modules: <a href="openFile:E:/Software house/APPS/Building Apps/App 3 YourRecipesApp Online/App Model/Recipes Master/app/build.gradle">app</a> 
    Failed to resolve: com.android.support:exifinterface:28
    <a href="open.dependency.in.project.structure">Show in Project Structure dialog</a>
    Affected Modules: <a href="openFile:E:/Software house/APPS/Building Apps/App 3 YourRecipesApp Online/App Model/Recipes Master/app/build.gradle">app</a> 
    Failed to resolve: com.android.support:support-v4:28
    <a href="open.dependency.in.project.structure">Show in Project Structure dialog</a>
    Affected Modules: <a href="openFile:E:/Software house/APPS/Building Apps/App 3 YourRecipesApp Online/App Model/Recipes Master/app/build.gradle">app</a> 
    Failed to resolve: com.android.support:customtabs:28
    <a href="open.dependency.in.project.structure">Show in Project Structure dialog</a>
    Affected Modules: <a href="openFile:E:/Software house/APPS/Building Apps/App 3 YourRecipesApp Online/App Model/Recipes Master/app/build.gradle">app</a> 
    Failed to resolve: com.android.support:appcompat-v7:29.0.1
    <a href="open.dependency.in.project.structure">Show in Project Structure dialog</a>
    Affected Modules: <a href="openFile:E:/Software house/APPS/Building Apps/App 3 YourRecipesApp Online/App Model/Recipes Master/app/build.gradle">app</a> 
    Failed to resolve: com.android.support:design:29.0.1
    <a href="open.dependency.in.project.structure">Show in Project Structure dialog</a>
    Affected Modules: <a href="openFile:E:/Software house/APPS/Building Apps/App 3 YourRecipesApp Online/App Model/Recipes Master/app/build.gradle">app</a> 
    Failed to resolve: com.android.support:cardview-v7:29.0.1
    <a href="open.dependency.in.project.structure">Show in Project Structure dialog</a>
    Affected Modules: <a href="openFile:E:/Software house/APPS/Building Apps/App 3 YourRecipesApp Online/App Model/Recipes Master/app/build.gradle">app</a> 
    Failed to resolve: com.android.support:palette-v7:29.0.1
    <a href="open.dependency.in.project.structure">Show in Project Structure dialog</a>
    Affected Modules: <a href="openFile:E:/Software house/APPS/Building Apps/App 3 YourRecipesApp Online/App Model/Recipes Master/app/build.gradle">app</a> 
    Failed to resolve: com.android.support:recyclerview-v7:29.0.1
    <a href="open.dependency.in.project.structure">Show in Project Structure dialog</a>
    Affected Modules: <a href="openFile:E:/Software house/APPS/Building Apps/App 3 YourRecipesApp Online/App Model/Recipes Master/app/build.gradle">app</a>

【问题讨论】:

标签: android


【解决方案1】:

在 Android Studio 中,转到Refactor-&gt;Migrate to AndroidX...

【讨论】:

  • 如果您迁移了,您将不会拥有像 com.android.support:appcompat-v7:29.0.1 这样的东西。你会有类似androidx.appcompat:appcompat:1.0.0
【解决方案2】:

以下工件不存在:

implementation 'com.android.support:appcompat-v7:29.0.1'
implementation 'com.android.support:design:29.0.1'
implementation 'com.android.support:cardview-v7:29.0.1'
implementation 'com.android.support:palette-v7:29.0.1'
implementation 'com.android.support:recyclerview-v7:29.0.1'

最后一个支持库版本是28.0.0,你可以看到here

compileSdkVersionbuildToolsVersion 更新到 API 29,但将支持库保持在版本 28.0.0

但是,如您所见,支持库现在在版本 28 中被冻结。因此,它在某种程度上已被弃用。因此,另一种选择是将您的项目迁移到AndroidX。它基本上是一个新名称的支持库(用非常简单的话来说)。

【讨论】:

  • 我已迁移到 androidX。你能告诉我 projectSupportLibraryVersion、projectMinSdkVersion、projectSdkVersion、projectBuildToolsVersion 的最新版本是什么
猜你喜欢
  • 1970-01-01
  • 1970-01-01
  • 2022-01-09
  • 2021-06-27
  • 2022-07-26
  • 1970-01-01
  • 2023-02-10
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多