Home > Software design >  I'm having an error building my application in android studio
I'm having an error building my application in android studio

Time:12-27

enter image description here

// this is the build.gradle(module:App)

plugins {
id 'com.android.application'
id 'com.google.gms.google-services'

}

android { compileSdkVersion 30 buildToolsVersion "30.0.3"

defaultConfig {
    applicationId "com.example.authapp"
    minSdkVersion 19
    targetSdkVersion 30
    versionCode 1
    versionName "1.0"
    multiDexEnabled true

    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
}
buildFeatures {
    mlModelBinding true
}

}

dependencies {

implementation 'androidx.appcompat:appcompat:1.3.1'
implementation 'com.google.android.material:material:1.4.0'
implementation 'androidx.constraintlayout:constraintlayout:2.1.1'
implementation 'com.google.firebase:firebase-auth:21.0.1'
implementation 'com.google.firebase:firebase-database:20.0.2'
implementation 'com.android.support:multidex:1.0.3'
implementation platform('com.google.firebase:firebase-bom:29.0.0')
implementation 'com.google.mlkit:image-labeling:17.0.5'
implementation 'org.tensorflow:tensorflow-lite-support:0.1.0'
implementation 'org.tensorflow:tensorflow-lite-metadata:0.1.0'
testImplementation 'junit:junit:4. '
androidTestImplementation 'androidx.test.ext:junit:1.1.3'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.4.0'

} apply plugin: 'com.google.gms.google-services'

// this is the Build.gradle(project: auth_app)

//

 Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
    repositories {
        google()
        mavenCentral()
    }
    dependencies {
        classpath "com.android.tools.build:gradle:4.2.1"
        classpath 'com.google.gms:google-services:4.3.10'
        // NOTE: Do not place your application dependencies here; they belong
        // in the individual module build.gradle files
    }
}

allprojects {
    repositories {
        google()
        mavenCentral()
        // Warning: this repository is going to shut down soon
    }
}

task clean(type: Delete) {
    delete rootProject.buildDir
}

I have no idea on how to fix this error can anyone pls assist me

this is the error in our project

Task :app:mergeDebugJavaResource FAILED
Execution failed for task ':app:mergeDebugJavaResource'.
> A failure occurred while executing com.android.build.gradle.internal.tasks.MergeJavaResWorkAction
   > 2 files found with path 'androidsupportmultidexversion.txt' from inputs:
      - C:\Users\63921\.gradle\caches\transforms-2\files-2.1\480913dfb7b73ce9375e43aa9e1a997f\multidex-2.0.0\jars\classes.jar
      - C:\Users\63921\.gradle\caches\transforms-2\files-2.1\4f2dc8a20d0b51cf9b4d1765b971973c\multidex-1.0.3\jars\classes.jar
     Adding a packagingOptions block may help, please refer to
     https://google.github.io/android-gradle-dsl/current/com.android.build.gradle.internal.dsl.PackagingOptions.html
     for more information

* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.

CodePudding user response:

Try adding this in your gradle file :

packagingOptions{
     pickFirst “androidsupportmultidexversion.txt”
}

This will solve the conflict by picking up the first androidsupportmultidexversion.txt file.

  • Related