Can't implement library, Unable to merge dex - java

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

Related

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'
}

Execution failed for task ':app:preDebugAndriodTestBuild'

My question is about an error in Android Studio.
Every time when i try to run a java project in Android Studio i get the below error and my program doesn't not work :
This is my gradle configuration:
apply plugin: 'com.android.application'
android {
compileSdkVersion 26
defaultConfig {
applicationId "com.example.christianmastracco.jsondemo"
minSdkVersion 22
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.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'
}
How i can solve it? Thanks
Change your compileSdkVersion and targetSdkVersion to 27 and this:
implementation 'com.android.support:appcompat-v7:26.1.0'
to this
implementation 'com.android.support:appcompat-v7:27.1.0'
Update your compileSdkVersion and targetSdkVersion, both, into version 27 and implementation version 27.1.1 as shown in error message.
I can't comment at Ernest Zamelczyk answer (reputation 50) but I think the correct answer is 27.1.1, not 27.1.0 as he told.

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

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.

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