Getting a "failed to merge dex" error on Android Studio - java

I am a student and am stuck. I am getting this error:
Error:Execution failed for task ':app:transformDexArchiveWithExternalLibsDexMergerForDebug'.
> java.lang.RuntimeException: com.android.builder.dexing.DexArchiveMergerException: Unable to merge dex
Gradle:
apply plugin: 'com.android.application'
android {
compileSdkVersion 27
defaultConfig {
applicationId "com.example.ChangedThisforPrivacy"
minSdkVersion 22
targetSdkVersion 27
versionCode 1
versionName "1.0"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
multiDexEnabled true
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
//noinspection GradleCompatible
implementation 'com.android.support:appcompat-v7:27.1.0'
implementation 'com.android.support.constraint:constraint-layout:1.1.0'
implementation 'com.android.support:support-v4:27.1.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 "com.google.android.gms:play-services:12.0.1"
}
I have tried a Clean and then Build, and the issue remains.

Related

Gradle sync failed: setup project failed: java.io.EOFException

I add a PrefManager file in my project to check first time login in app.After that I start sync gradle.It show me Gradle sync failed: setup project failed: java.io.EOFException error
apply plugin: 'com.android.application'
apply plugin: 'com.google.gms.google-services'
android {
compileSdkVersion 27
defaultConfig {
applicationId "comviewappisome.google.sites.watchandearn"
minSdkVersion 17
targetSdkVersion 27
versionCode 1
versionName "1.0"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation 'com.android.support:appcompat-v7:27.1.1'
implementation 'com.android.support:customtabs:27.1.1'
implementation 'com.android.support.constraint:constraint-layout:1.1.3'
implementation 'com.android.support:support-v4:27.1.1'
implementation 'com.android.support:design:27.1.1'
implementation 'com.google.android.gms:play-services-ads:17.1.2'
implementation 'com.google.firebase:firebase-core:16.0.6'
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'
implementation project(':luckyWheel')
implementation 'com.google.firebase:firebase-database:16.0.5'
}

ERROR: Failed to resolve: android.support:support.v7:29.0.2

I am new to Android studio. I am facing a problem with the coding part. While running the code it shows an error.
Thw gradle part is shown below
apply plugin: 'com.android.application'
android {
compileSdkVersion 29
buildToolsVersion "29.0.2"
defaultConfig {
applicationId "com.example.fallprediction"
minSdkVersion 14
targetSdkVersion 29
versionCode 1
versionName "1.0"
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation 'androidx.appcompat:appcompat:1.1.0'
implementation 'androidx.constraintlayout:constraintlayout:1.1.3'
testImplementation 'junit:junit:4.13'
androidTestImplementation 'androidx.test.ext:junit:1.1.1'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.2.0'
implementation 'android.support:support.v7:29.0.2'
}
The error is
ERROR: Failed to resolve: android.support:support.v7:29.0.2
Show in Project Structure dialog
Affected Modules: app
Please help me to resolve this error
Convert this into androidx or remove this dependency implementation 'android.support:support.v7:29.0.2

More than one file was found with OS independent path 'README.md'

I'm trying to use selendroid in my app as webscraper, but I get this error "More than one file was found with OS independent path 'README.md'" .
Any thoughts on how to fix it?
build.gradle
apply plugin: 'com.android.application'
android {
compileSdkVersion 28
defaultConfig {
applicationId "ru.startandroid.testselenium2"
minSdkVersion 15
targetSdkVersion 28
versionCode 1
versionName "1.0"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation 'com.android.support:appcompat-v7:28.0.0'
implementation 'com.android.support.constraint:constraint-layout:1.1.3'
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'
implementation files('D:\\chromedriver\\selendroid-client-0.17.0.jar')
implementation files('D:\\chromedriver\\selendroid-standalone-0.17.0-with-dependencies.jar')
}
Add this to your android closure:
packagingOptions {
exclude 'README.md'
}

Can't implement library, Unable to merge dex

i am trying to use the apache commons library to upload image using ftp but i keep getting this error every time i run the app.
The error is:
Error:Execution failed for task ':app:transformDexArchiveWithExternalLibsDexMergerForDebug'.
java.lang.RuntimeException: com.android.builder.dexing.DexArchiveMergerException: Unable to merge dex
my build.grandle file look like this:
apply plugin: 'com.android.application'
android {
compileSdkVersion 26
defaultConfig {
applicationId "com.example.david.six_month"
minSdkVersion 15
multiDexEnabled true
targetSdkVersion 26
versionCode 1
versionName "1.0"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation 'com.android.support:appcompat-v7:26.1.0'
implementation 'com.android.support.constraint:constraint-layout:1.0.2'
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 'commons-net:commons-net:3.6'
}
What is the issue?
I tried clean project and rebuild but nothing seems to be workin..

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

i already inserted from the build.app clean and rebuild. i dont know how to fix this problem here's my code.
My inserted code
multiDexEnabled true
compile 'com.sun.mail:javax.mail:1.6.1'
implementation 'com.android.support:multidex:1.0.2'
implementation 'com.google.android.gms:play-services:11.4.0'
Build.app
android {
compileSdkVersion 26
defaultConfig {
applicationId "com.example.coorsdev.sendsms"
minSdkVersion 14
targetSdkVersion 26
versionCode 1
versionName "1.0"
multiDexEnabled true //attached requires
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}dependencies {
//attached requires
compile 'com.sun.mail:javax.mail:1.6.1'
implementation 'com.android.support:multidex:1.0.2'
implementation 'com.google.android.gms:play-services:11.4.0'
implementation fileTree(dir: 'libs', include: ['*.jar'])
//noinspection GradleCompatible
implementation 'com.android.support:appcompat-v7:26.1.0'
implementation 'com.android.support.constraint:constraint-layout:1.0.2'
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'
When it runs, this is my result from my Message.
Error:Execution failed for task
:app:transformDexArchiveWithExternalLibsDexMergerForDebug.
com.android.builder.dexing.DexArchiveMergerException: Unable to merge
dex

Categories

Resources