Unable to merge dex error

Hi

I am getting error Unable to merge dex

that’s my gradle

I have already done following

  • clean and rebuild
  • Invalidate and restart
  • multiDexEnabled true
  • implementation ‘com.android.support:multidex:1.0.1’
  • Delete .gradle folder and restart android studio

Still problem is not resolved I am stuck from 2 days please help

apply plugin: ‘com.android.application’

android {
compileSdkVersion 26
defaultConfig {
applicationId “com.example.admin.chalklitv4”
minSdkVersion 26
targetSdkVersion 26
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’
}
}
packagingOptions {
exclude ‘META-INF/DEPENDENCIES’
exclude ‘META-INF/NOTICE’
exclude ‘META-INF/LICENSE’
exclude ‘META-INF/LICENSE.txt’
exclude ‘META-INF/NOTICE.txt’
}
dexOptions {
javaMaxHeapSize “4g”

    jumboMode = true
}

}

dependencies {
implementation fileTree(dir: ‘libs’, include: [‘*.jar’])
implementation ‘com.android.support:appcompat-v7:26.1.0’
implementation ‘com.android.support:multidex:1.0.1’
//implementation ‘com.google.android.gms: play-services: 11.6.0’
testImplementation ‘junit:junit:4.12’
androidTestImplementation ‘com.android.support.test:runner:1.0.1’

//androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.1'
implementation 'io.appium:java-client:5.0.4'
// https://mvnrepository.com/artifact/org.testng/testng
implementation group: 'org.testng', name: 'testng', version: '6.9.10'
implementation group: 'org.seleniumhq.selenium', name: 'selenium-java', version: '3.6.0'

}

Following is the error

Error:Execution failed for task ‘:app:transformDexArchiveWithExternalLibsDexMergerForDebug’.

java.lang.RuntimeException: com.android.builder.dexing.DexArchiveMergerException: Unable to merge dex

have you managed to resolve this?

No it encountered while using selenium with testng. With Junit it’s working

Please help

What I understand by reading all solutions that it is appearing because of some incompatible files.

Please suggest right combination of Java client , testng and selenium versions