我有这个错误



我在Android Studio正在下载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的说法:这是Support Library 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'

在你的摇篮中

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

关于crash - Android Studio在首次运行时崩溃,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/59132452/

10-11 04:13
查看更多