首页 > 解决方案 > 如何解决这个显示 attr/**** not found 的构建错误?

问题描述

我正在开发一个颤振应用程序并使用 stripe_payment 插件进行 stipe。Flutter 插件使用 Stripe Android 库并将其与 Flutter 桥接

我升级到 v1.1.3,现在面临以下错误

Users/kng/.gradle/caches/transforms-2/files-2.1/8c719ab381347948d45fa88e7c0d384d/jetified-payments-core-16.10.0/res/values/values.xml:392:5-411:13: AAPT: error: style attribute 'attr/cardForegroundColor (aka com.zipcab.ziprider:attr/cardForegroundColor)' not found.

/Users/kng/.gradle/caches/transforms-2/files-2.1/8c719ab381347948d45fa88e7c0d384d/jetified-payments-core-16.10.0/res/values/values.xml:431:5-435:13: AAPT: error: style attribute 'attr/colorOnSurface (aka com.zipcab.ziprider:attr/colorOnSurface)' not found.

/Users/kng/.gradle/caches/transforms-2/files-2.1/8c719ab381347948d45fa88e7c0d384d/jetified-payments-core-16.10.0/res/values/values.xml:444:5-453:13: AAPT: error: style attribute 'attr/colorSurface (aka com.zipcab.ziprider:attr/colorSurface)' not found.

我无法修复它。我什至尝试添加材料和应用程序紧凑库,但问题仍然存在。库 GitHub 问题不是很活跃,我在那里找不到这个错误。我需要提交这个应用程序,因为问题来自图书馆,所以很难修复它。

我的 app.gradel

def localProperties = new Properties()
def localPropertiesFile = rootProject.file('local.properties')
if (localPropertiesFile.exists()) {
    localPropertiesFile.withReader('UTF-8') { reader ->
        localProperties.load(reader)
    }
}

def flutterRoot = localProperties.getProperty('flutter.sdk')
if (flutterRoot == null) {
    throw new GradleException("Flutter SDK not found. Define location with flutter.sdk in the local.properties file.")
}

def flutterVersionCode = localProperties.getProperty('flutter.versionCode')
if (flutterVersionCode == null) {
    flutterVersionCode = '2'
}

def flutterVersionName = localProperties.getProperty('flutter.versionName')
if (flutterVersionName == null) {
    flutterVersionName = '1.0.1'
}

apply plugin: 'com.android.application'
apply plugin: 'kotlin-android'
apply plugin: 'com.google.gms.google-services'
apply from: "$flutterRoot/packages/flutter_tools/gradle/flutter.gradle"
apply plugin: 'com.google.firebase.crashlytics'


android {
    compileSdkVersion 29

    sourceSets {
        main.java.srcDirs += 'src/main/kotlin'
    }

    lintOptions {
        disable 'InvalidPackage'
    }

    defaultConfig {
        // TODO: Specify your own unique Application ID (https://developer.android.com/studio/build/application-id.html).
        applicationId "com.zipcab.ziprider"
        minSdkVersion 21
        targetSdkVersion 29
        multiDexEnabled true
        versionCode 1
        versionName '1.0'
        testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
    }

    buildTypes {
        release {
            // TODO: Add your own signing config for the release build.
            // Signing with the debug keys for now, so `flutter run --release` works.
            signingConfig signingConfigs.debug
        }
    }
}

flutter {
    source '../..'
}

configurations.all {
    resolutionStrategy.force "com.google.android.gms:play-services-ads:19.3.0"
    resolutionStrategy.force "com.google.android.gms:play-services-base:17.3.0"
    resolutionStrategy.force "com.google.android.gms:play-services-basement:17.3.0"
    resolutionStrategy.force "com.google.android.gms:play-services-location:17.0.0"
    resolutionStrategy.force "com.google.android.gms:play-services-maps:17.0.0"
}


dependencies {
    implementation "androidx.core:core:1.5.0"
    // https://mvnrepository.com/artifact/com.google.android.material/material
    implementation group: 'com.google.android.material', name: 'material', version: '1.3.0'

    implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
    testImplementation 'junit:junit:4.12'
    androidTestImplementation 'androidx.test:runner:1.1.1'
    androidTestImplementation 'androidx.test.espresso:espresso-core:3.1.1'
    implementation platform('com.google.firebase:firebase-bom:25.12.0')
    implementation 'com.google.android.gms:play-services-auth:18.1.0'
    implementation 'com.google.firebase:firebase-analytics:17.2.2'
    implementation 'com.google.firebase:firebase-messaging:20.0.1'

}

请帮助我,因为我是新手,无法找到解决方法

标签: androidflutterdartgradleflutter-dependencies

解决方案


推荐阅读