Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Program type already present: com.google.android.gms.common.util.VisibleForTesting -':app:transformDexArchiveWithExternalLibsDexMergerForDebug' [duplicate]

I am getting this error whenever I try to run a program in Android Studio 3.1.2.

Program type already present: com.google.android.gms.common.util.VisibleForTesting Message{kind=ERROR, text=Program type already present: com.google.android.gms.common.util.VisibleForTesting, sources=[Unknown source file], tool name=Optional.of(D8)}

My gradle Module app :

buildscript {
repositories {
    google()
    jcenter()

    maven {
        url "https://maven.google.com" // Google's Maven repository
    }
}
dependencies {
    classpath 'com.android.tools.build:gradle:3.1.2'
    classpath 'com.google.gms:google-services:3.2.1'

    // NOTE: Do not place your application dependencies here; they belong
    // in the individual module build.gradle files
}

}

allprojects {
repositories {
    google()
    jcenter()

    maven {
        url "https://maven.google.com"
    }
    maven {
        url "https://maven.fabric.io/public"
    }
}

}

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

}

This is my Gradle Module app

apply plugin: 'com.android.application'

android {
compileSdkVersion 27
defaultConfig {
    applicationId "myproject"
    minSdkVersion 19
    targetSdkVersion 27
    versionCode 1
    versionName "1.0"
    multiDexEnabled true
    testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}
buildTypes {
    release {
        minifyEnabled false
        proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
    }
}

compileOptions {
    sourceCompatibility JavaVersion.VERSION_1_8
    targetCompatibility JavaVersion.VERSION_1_8
}

}

dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
//noinspection GradleCompatible
implementation 'com.android.support:appcompat-v7:27.1.1'
implementation'com.android.support:design:27.1.1'
implementation 'com.android.support.constraint:constraint-layout:1.1.0'
testImplementation 'junit:junit:4.12'
androidTestImplementation 'com.android.support.test:runner:1.0.2'
androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.2'enter code here



// FirebaseUI for Firebase Auth
implementation 'com.firebaseui:firebase-ui-auth:3.3.1'
implementation 'com.google.firebase:firebase-auth:15.0.0'
//Firebase RealTime Database
implementation 'com.google.firebase:firebase-database:15.0.0'
// FirebaseUI for Cloud Storage
implementation 'com.firebaseui:firebase-ui-storage:3.3.1'
implementation 'com.google.firebase:firebase-storage:15.0.0'

//circleimageView
implementation 'de.hdodenhof:circleimageview:2.1.0'

//Libreria utilizada para medir dimension de layout de chat cuando cambia de tamaño
implementation 'net.the4thdimension:android-utils:2.0.4'

//To scale every screen sizes , sp
implementation 'com.intuit.sdp:sdp-android:1.0.5'

//authenticacion para formato de numero de telefono
implementation 'com.googlecode.libphonenumber:libphonenumber:8.4.2'
implementation 'com.weiwangcn.betterspinner:library-material:1.1.0'
implementation 'com.amitshekhar.android:android-networking:1.0.0'

//Volley
implementation 'com.android.volley:volley:1.0.+'
implementation 'org.apache.commons:commons-lang3:3.6'

}

apply plugin: 'com.google.gms.google-services'
like image 952
Liliana J Avatar asked Feb 05 '23 00:02

Liliana J


1 Answers

If the issues persists after updating the google play gradle plugin version to latest version, search for the given file in the entire project using the Android Studio File Search and look for the searches with the same package name. The issue was that the file with the same package and file name was present in two different jars (In my case, one jar was of old google analytics services jar which had been manually downloaded and added as a library in the project). Please check image for clarity. We have to resolve this conflict (I had removed my old jar as it was no longer needed) and the project would build.

like image 86
Sidharth Sethia Avatar answered Feb 06 '23 15:02

Sidharth Sethia