skip to Main Content

I keep getting this error when I try to build apk or run app. My project does not seem to have any library that uses camera features, non that I can see from my end. Let me know if you need to see my pubspec file as well.

    /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.

This is my 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")
}

Then this is my project build.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
}

My distributionUrl

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

Please assist as I have been stuck here for days. I’ve tried multiple kotlin version but nothing seems to work.

2

Answers


  1. I recently had a similar problem and I only managed to solve it once I searched and found that you have say problem. I am not sure if this will help you but it worked with my project. Clean the Gradle Cache. and try building your project again. this is usually due to trying to build or run the project multiple times especially if you had to change your dependencies. all the best.

    Login or Signup to reply.
  2. is this issue solved? i am getting the same errror

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search