Execution failed for task ‘:app:checkDebugAarMetadata‘.

AS报错:

Execution failed for task ':app:checkDebugAarMetadata'.
could not resolve all dependencies for configuration ':app:debugruntimeclasspath'.
Could not find com.android.support.constraint:constraint-layout:1.0.1.

按照网上介绍的项目build.gradle 的buildscript 和 allprojects同时加上

mavenCentral()
google()

最终解决办法:

按照这篇文章介绍的方法
在项目的build.gradle (Module: app)中增加了如下代码:

implementation 'com.google.android.material:material: 1.2.1'
implementation "androidx.constraintlayout:constraintlayout:2.0.2"
implementation "androidx.appcompat:appcompat:$appcompat_version"
implementation "androidx.appcompat:appcompat-resources:$appcompat_version"
implementation "com.android.support:support-core-utils:28.0.0"

后来又去掉了报错行,变成如下:

dependencies {
    
    
    implementation fileTree(dir: 'libs', include: ['*.jar'])
    androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', {
    
    
        exclude group: 'com.android.support', module: 'support-annotations'
    })
    implementation 'com.android.support:appcompat-v7:25.2.0'
    implementation 'com.android.support.constraint:constraint-layout:1.0.1'
    testImplementation 'junit:junit:4.12'

	implementation "androidx.constraintlayout:constraintlayout:2.0.2"
	implementation "com.android.support:support-core-utils:28.0.0"
}

猜你喜欢

转载自blog.csdn.net/weixin_47542175/article/details/115056367