Android Studio 配置为“DEFAULT”且产品为“”的资源“attr/scaleType”的值重复

bzzcjhmw  于 2023-10-23  发布在  Android
关注(0)|答案(1)|浏览(141)

当我尝试构建apk或运行应用程序时,我一直得到这个错误。我的项目似乎没有任何库,使用相机功能,非我可以看到从我的结束。如果你也想看我的pubspec文件,请告诉我。

/Users/username/.gradle/caches/transforms-3/cf10bc8dfd22519fd63f47c2693208ec/transformed/jetified-ui_legacy-9.2.1/res/values/values.xml:890:4: Duplicate value for resource 'attr/scaleType' with config 'DEFAULT' and product ''. Resource was previously defined here: /Users/username/.gradle/caches/transforms-3/30f3f4898430fda189929c76ff99a8c3/transformed/jetified-camera-view-1.2.3/res/values/values.xml:6:4: .

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':app:mergeReleaseResources'.
> A failure occurred while executing com.android.build.gradle.internal.res.ResourceCompilerRunnable
   > Resource compilation failed. Check logs for details.

这是我的app/gradle

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 = '1'
}

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

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

android {
    compileSdkVersion 33

    compileOptions {
        sourceCompatibility JavaVersion.VERSION_11
        targetCompatibility JavaVersion.VERSION_11
    }

    kotlinOptions {
        jvmTarget = '1.8'
    }

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

    defaultConfig {
        // TODO: Specify your own unique Application ID (https://developer.android.com/studio/build/application-id.html).
        applicationId "com.xxx.xxx"
        minSdkVersion 21
        targetSdkVersion 33
        versionCode 16
        versionName '2.1.9'
    }

    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
            minifyEnabled false
            shrinkResources false
        }
    }
    buildToolsVersion '29.0.3'
}

flutter {
    source '../..'
}

dependencies {
    implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
    implementation platform('com.google.firebase:firebase-bom:26.6.0')
    implementation 'androidx.multidex:multidex:2.0.1'
    implementation 'com.mercadopago.android.px:checkout:4.+'
    implementation('com.braintreepayments.api:drop-in:5.2.1'){
        exclude group: "org.jfrog.cardinalcommerce.gradle", module: "cardinalmobilesdk"
    }
    implementation("org.jfrog.cardinalcommerce.gradle:cardinalmobilesdk:2.2.7-2")
}

这是我的项目构建。gradle

buildscript {
    ext.kotlin_version = '1.8.0'
    repositories {
        google()
        mavenCentral()
    }

    dependencies {
        classpath 'com.android.tools.build:gradle:7.1.3'
        classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
        classpath 'com.google.gms:google-services:4.3.15'

        classpath 'com.google.firebase:firebase-crashlytics-gradle:2.8.1'
    }
}

allprojects {
    repositories {
        google()
        mavenCentral()
    }
}

rootProject.buildDir = '../build'
subprojects {
    project.buildDir = "${rootProject.buildDir}/${project.name}"
}
subprojects {
    project.evaluationDependsOn(':app')
}

tasks.register("clean", Delete) {
    delete rootProject.buildDir
}

我的分发URL

distributionUrl=https\://services.gradle.org/distributions/gradle-7.5-all.zip

请帮助我,因为我被困在这里好几天了。我尝试了多个Kotlin版本,但似乎没有工作。

bjp0bcyl

bjp0bcyl1#

我最近有一个类似的问题,我只设法解决它,一旦我搜索,发现你说的问题。我不知道这是否会帮助你,但它与我的项目。清理Gradle缓存。并尝试重新构建您的项目。这通常是由于多次尝试构建或运行项目,特别是当您必须更改依赖项时。祝你一切顺利。

相关问题