Android studio报错:Can‘t determine type for tag ‘<macro name=“m3

慈云数据 6个月前 (05-28) 技术支持 58 0

报错信息:

Can't determine type for tag '?attr/shapeAppearanceCornerSmall'

new的新project默认的build.gradle:

plugins {
    id 'com.android.application'
}
android {
    compileSdkVersion 34
    buildToolsVersion "34.0.0"
    defaultConfig {
        applicationId "com.anxko.backend.app"
        minSdkVersion 24
        targetSdkVersion 34
        versionCode 1
        versionName "1.0"
        testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
    }
    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
        }
    }
    compileOptions {
        sourceCompatibility JavaVersion.VERSION_1_8
        targetCompatibility JavaVersion.VERSION_1_8
    }
}
dependencies {
    implementation 'androidx.appcompat:appcompat:1.6.1'
    implementation 'com.google.android.material:material:1.11.0'
    implementation 'androidx.constraintlayout:constraintlayout:2.1.4'
    testImplementation 'junit:junit:4.+'
    androidTestImplementation 'androidx.test.ext:junit:1.1.5'
    androidTestImplementation 'androidx.test.espresso:espresso-core:3.5.1'
}

网上查找了一下解决方案有两种:

1.降低com.google.android.material:material:xxx这个库的版本

2.升级gradle plugin版本

第二种太麻烦了,还要升级gradle的版本,所以我用的第一种方法。在中央仓库查看了一下版本,一个个向下降级试了一下,最终发现1.6.1版本可以正常build

微信扫一扫加客服

微信扫一扫加客服

点击启动AI问答
Draggable Icon