未解决的依赖关系:找不到任何匹配 com.android.support:appcompat-v7:29.+ 的版本

Unresolved dependency :Could not find any version that matches com.android.support:appcompat-v7:29.+

当我在 intelliJ

上打开一个新的 android 项目时,总是出现这个未解决的依赖错误

我试过:

  1. 取消选中离线框
  2. 正在更新 gradle
  3. 正在从gradel官网下载最新版本并设置gradle源文件。
  4. 从“29.+”更改。到“29.0.0”

错误信息:

ERROR: Unable to resolve dependency for ':app@debug/compileClasspath': Could not find any version that matches com.android.support:appcompat-v7:29.+. Show Details Affected Modules: app

ERROR: Unable to resolve dependency for ':app@debugAndroidTest/compileClasspath': Could not find any version that matches com.android.support:appcompat-v7:29.+. Show Details Affected Modules: app

ERROR: Unable to resolve dependency for ':app@debugUnitTest/compileClasspath': Could not find any version that matches com.android.support:appcompat-v7:29.+. Show Details Affected Modules: app

ERROR: Unable to resolve dependency for ':app@release/compileClasspath': Could not find any version that matches com.android.support:appcompat-v7:29.+. Show Details Affected Modules: app

ERROR: Unable to resolve dependency for ':app@releaseUnitTest/compileClasspath': Could not find any version that matches com.android.support:appcompat-v7:29.+. Show Details Affected Modules: app

您应该使用 Android Studio。下载 gradle 并将其链接到自己的项目不是一个好的做法。你应该让你的 IDE 为你处理所有的工作,同时你专注于用你宝贵的时间编写好的代码。你应该做的是

  1. 从官方网站下载Android工作室
  2. 创建一个新项目并获得快速稳定的互联网连接
  3. Android studio 将在第一次构建时下载并安装 gradle,您可以开始使用了

您甚至可以用最好(最高)的 SDK 版本创建一个新项目,然后用您自己的项目检查 Gradle 文件中的差异。这真的很有帮助。

它发生是因为 com.android.support:appcompat-v7:29.x.x 不存在

您可以查看 revision history and the google maven repo:

27.0.2
27.1.0
27.1.1
28.0.0-alpha1
28.0.0-alpha3
28.0.0-beta01
28.0.0-rc01
28.0.0-rc02
28.0.0

Also check this important note:

Note: With the release of Android 9.0 (API level 28) there is a new version of the support library called AndroidX which is part of Jetpack. The AndroidX library contains the existing support library and also includes the latest Jetpack components.

You can continue to use the support library. Historical artifacts (those versioned 27 and earlier, and packaged as android.support.*) will remain available on Google Maven. However, all new library development will occur in the AndroidX library.

We recommend using the AndroidX libraries in all new projects. You should also consider migrating existing projects to AndroidX as well.