Could not resolve all files for configuration ‘:app:debugUnitTestCompileClasspath‘.

Android studio搭建java main方法,运行时报错,解决:

在project下的build.gradle中检查配置:

// 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:4.1.1"

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

allprojects {
    repositories {
        google()
        jcenter()
        mavenCentral ()//加入这个关键配置
    }
}

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

你可能感兴趣的:(Android,studio日常错误,android,studio,android,gradle)