Android 工作室在第一个 运行 中崩溃

Android studio crashed in the first run

我遇到了这个错误

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

我在 Android 工作室下载 gradle 时睡觉,所以我的笔记本电脑进入睡眠模式并停止了所有操作。

现在我收到上面的错误。我认为第一个 运行 下载中缺少某些内容,我该如何修复它?

------------编辑

apply plugin: 'com.android.application'
android {
    compileSdkVersion 29
    buildToolsVersion "29.0.2"
    defaultConfig {
        applicationId "com.example.myapplication"
        minSdkVersion 15
        targetSdkVersion 29
        versionCode 1
        versionName "1.0"
        testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
    }
    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
        }
    }
}

dependencies {
    implementation fileTree(dir: 'libs', include: ['*.jar'])
    implementation 'com.android.support:appcompat-v7:29.+'
    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'
}

和第二个

// Top-level build file where you can add configuration options common to all sub-projects/modules.

buildscript {
    repositories {
        google()
        jcenter()

    }
    dependencies {
        classpath 'com.android.tools.build:gradle:3.3.0'

        // NOTE: Do not place your application dependencies here; they belong
        // in the individual module build.gradle files
    }
}

allprojects {
    repositories {
        google()
        jcenter()

    }
}

task clean(type: Delete) {
    delete rootProject.buildDir
}

根据 Google:这是支持库 28.0.0 的稳定版本,适合在生产中使用。这将是 android.support 打包下的最后一个功能版本,鼓励开发者迁移到 AndroidX。

参考https://developer.android.com/topic/libraries/support-library/revisions

这就是您在

上收到错误的原因
implementation 'com.android.support:appcompat-v7:29.+' 

要么迁移到 androidX,要么您可以使用

implementation 'com.android.support:appcompat-v7:28.0.0' 
implementation 'com.android.support:support-v4:28.0.0'

在你的 gradle

希望对您有所帮助 快乐编码