I am unable to build my project, it is returning me one error. There are no errors in the files themselves, only upon a build.
This is the following error:
Error:Execution failed for task ':app:dexDebug'.
> com.android.ide.common.internal.LoggedErrorException: Failed to run command:
C:\Users\Jay\AppData\Local\Android\sdk\build-tools\21.1.2\dx.bat --dex --no-optimize --output C:\Users\Jay\Desktop\UploadToServer\app\build\intermediates\dex\debug --input-list=C:\Users\Jay\Desktop\UploadToServer\app\build\intermediates\tmp\dex\debug\inputList.txt
Error Code:
2
Output:
UNEXPECTED TOP-LEVEL EXCEPTION:
com.android.dex.DexException: Multiple dex files define Landroid/support/v4/accessibilityservice/AccessibilityServiceInfoCompatIcs;
at com.android.dx.merge.DexMerger.readSortableTypes(DexMerger.java:596)
at com.android.dx.merge.DexMerger.getSortedTypes(DexMerger.java:554)
at com.android.dx.merge.DexMerger.mergeClassDefs(DexMerger.java:535)
at com.android.dx.merge.DexMerger.mergeDexes(DexMerger.java:171)
at com.android.dx.merge.DexMerger.merge(DexMerger.java:189)
at com.android.dx.command.dexer.Main.mergeLibraryDexBuffers(Main.java:454)
at com.android.dx.command.dexer.Main.runMonoDex(Main.java:303)
at com.android.dx.command.dexer.Main.run(Main.java:246)
at com.android.dx.command.dexer.Main.main(Main.java:215)
at com.android.dx.command.Main.main(Main.java:106)
I have read on a few other post that it could be multiples of the same jar files in the libs folder but currently my folder is empty, I am not to sure what the issue is, I would appreciate if someone could help.
Here is my module build.gradle
apply plugin: 'com.android.application'
android {
compileSdkVersion 21
buildToolsVersion "21.1.2"
defaultConfig {
applicationId "com.example.jay.uploadtoserver"
minSdkVersion 16
targetSdkVersion 21
versionCode 1
versionName "1.0"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
compile 'com.android.support:appcompat-v7:21.0.3'
compile 'com.google.android.gms:play-services:+'
compile 'com.google.android:support-v4:r6'
compile 'org.apache.httpcomponents:httpmime:4.2.3'
}
Some of your jar files does not compile. You should go into your build.gradle file in your project, and look in your dependencies, if your just import some jar files, you could try to remove them, and add one at a time, to see which one of them makes the error.
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
compile 'com.android.support:appcompat-v7:21.0.3'
compile 'com.google.android.gms:play-services:+'
compile 'com.google.android:support-v4:18.0.+'
}
Remove compile 'com.google.android:support-v4:r6'. AppCompat already has this library
Related
When I integrated BoofCV into Android Studio, the following error happened,
com.android.dex.DexException: Multiple dex files define Lorg/xmlpull/v1/XmlPullParser;
at com.android.dx.merge.DexMerger.readSortableTypes(DexMerger.java:579)
at com.android.dx.merge.DexMerger.getSortedTypes(DexMerger.java:535)
at com.android.dx.merge.DexMerger.mergeClassDefs(DexMerger.java:517)
at com.android.dx.merge.DexMerger.mergeDexes(DexMerger.java:164)
at com.android.dx.merge.DexMerger.merge(DexMerger.java:188)
at com.android.dx.command.dexer.Main.mergeLibraryDexBuffers(Main.java:504)
at com.android.dx.command.dexer.Main.runMonoDex(Main.java:334)
at com.android.dx.command.dexer.Main.run(Main.java:277)
at com.android.dx.command.dexer.Main.main(Main.java:245)
at com.android.dx.command.Main.main(Main.java:106)
Error:Execution failed for task ':app:dexDebug'.
com.android.ide.common.process.ProcessException: org.gradle.process.internal.ExecException: Process 'command '/usr/lib/jvm/jdk1.8.0_60/bin/java'' finished with non-zero exit value 2
My build.gradle file is
apply plugin: 'com.android.application'
android {
compileSdkVersion 23
buildToolsVersion "23.0.2"
defaultConfig {
applicationId "com.example.huayu.boofcvandroidstart"
minSdkVersion 15
targetSdkVersion 23
versionCode 1
versionName "1.0"
//multiDexEnabled true
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
testCompile 'junit:junit:4.12'
compile 'com.android.support:appcompat-v7:23.1.1'
compile group: 'org.boofcv', name: 'all', version: '0.20'
}
Here's how I handled the issue. Include the BoofCV jars as you originally did. Then add the following to your app/build.gradle
configurations {
all*.exclude group: "xmlpull", module: "xmlpull"
}
That will remove the offending xmlpull. You also might want to include the android module, which isn't part of 'all'.
Here's an example on BoofAndroidDemo
https://github.com/lessthanoptimal/BoofAndroidDemo/blob/master/app/build.gradle
I have used BoofCV in one of my projects. You should add all the other BoofCV jars except the XmlPullParser because this jar conflicts with the already existing XmlPullParser present in Android.
I added BoofCV by downloading all the jars and only including the relevant ones like this:
dependencies {
compile files('libs/BoofCV-android-0.19.jar')
compile files('libs/BoofCV-calibration-0.19.jar')
compile files('libs/BoofCV-feature-0.19.jar')
compile files('libs/BoofCV-geo-0.19.jar')
compile files('libs/BoofCV-io-0.19.jar')
compile files('libs/BoofCV-ip-0.19.jar')
compile files('libs/BoofCV-recognition-0.19.jar')
compile files('libs/BoofCV-sfm-0.19.jar')
compile files('libs/BoofCV-visualize-0.19.jar')
compile files('libs/BoofCV-xuggler-0.19.jar')
compile files('libs/core-0.26.jar')
compile files('libs/ddogleg-0.7.jar')
compile files('libs/georegression-0.8.jar')
compile files('libs/xpp3_min-1.1.4c.jar')
compile files('libs/xstream-1.4.7.jar')
}
Although this is a naive way to add the jars you could just include the relevant jars in the libs folder and add this line:
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
}
I am trying to build my app but when i try to make it a signed apk it says this:
Error:Execution failed for task ':app:dexRelease'.
> com.android.ide.common.internal.LoggedErrorException: Failed to run command:
C:\Users\rik\AppData\Local\Android\sdk\build-tools\21.1.0\dx.bat --dex --output C:\Users\rik\Desktop\CCApp\app\build\intermediates\dex\release --input-list=C:\Users\rik\Desktop\CCApp\app\build\intermediates\tmp\dex\release\inputList.txt
Error Code:
2
Output:
UNEXPECTED TOP-LEVEL EXCEPTION:
com.android.dex.DexException: Multiple dex files define Lbolts/AggregateException;
at com.android.dx.merge.DexMerger.readSortableTypes(DexMerger.java:596)
at com.android.dx.merge.DexMerger.getSortedTypes(DexMerger.java:554)
at com.android.dx.merge.DexMerger.mergeClassDefs(DexMerger.java:535)
at com.android.dx.merge.DexMerger.mergeDexes(DexMerger.java:171)
at com.android.dx.merge.DexMerger.merge(DexMerger.java:189)
at com.android.dx.command.dexer.Main.mergeLibraryDexBuffers(Main.java:454)
at com.android.dx.command.dexer.Main.runMonoDex(Main.java:302)
at com.android.dx.command.dexer.Main.run(Main.java:245)
at com.android.dx.command.dexer.Main.main(Main.java:214)
at com.android.dx.command.Main.main(Main.java:106)
its really anoying me and i need to build the app very soon,
hope someone can help me
EDIT added build.gradle
build.gradle
apply plugin: 'com.android.application'
android {
compileSdkVersion 21
buildToolsVersion "21.1.0"
defaultConfig {
applicationId "it.experium.ccapp"
minSdkVersion 9
targetSdkVersion 21
versionCode 3
versionName "3.0"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
compile fileTree(dir: 'libs', include: 'ParseCrashReporting-*.jar')
compile 'com.parse.bolts:bolts-android:1.+'
compile fileTree(dir: 'libs', include: 'Parse-*.jar')
compile 'com.android.support:appcompat-v7:21.0.3'
}
EDIT file tree of the libs folder
parse-1.8.2-javadoc (Folder)
ParseCrashReporting-1.8.2-javadoc (Folder)
bolts-android-1.1.4 (Jar)
bolts-android-1.1.4 (Properties File)
bolts-android-1.1.4-javadoc (Jar)
Parse-1.8.2 (Jar)
Parse-1.8.2 (Properties file)
Rooster (In english Schedule, i have this because i request json's with this file. Jar)
third_party_licenses (TXT)
It seems like you are using here multiple jar files for same reference it may take some difference version of it..
So, it's better to remove below lines
compile fileTree(dir: 'libs', include: 'ParseCrashReporting-*.jar')
compile 'com.parse.bolts:bolts-android:1.+'
compile fileTree(dir: 'libs', include: 'Parse-*.jar')
Because 1st and 3rd line of this code included in single line so, no need to put those extra lines..
compile fileTree(dir: 'libs', include: ['*.jar'])
You are here putting external jar bolts-android-1.1.4 (Jar) as a reference from lib folder so, no need to add this gradle dependency..
compile 'com.parse.bolts:bolts-android:1.+'
So, after removing those 3 line sync project you will get your project running without any issue..
Let us know if anything needed...
I am developing an android app where I am integrating Google Plus Login. For this, I've added google play services library to my project. When I run my app, it gives me following error :
UNEXPECTED TOP-LEVEL EXCEPTION:
com.android.dex.DexException: Multiple dex files define Lcom/google/ads/AdRequest$ErrorCode;
at com.android.dx.merge.DexMerger.readSortableTypes(DexMerger.java:596)
at com.android.dx.merge.DexMerger.getSortedTypes(DexMerger.java:554)
at com.android.dx.merge.DexMerger.mergeClassDefs(DexMerger.java:535)
at com.android.dx.merge.DexMerger.mergeDexes(DexMerger.java:171)
at com.android.dx.merge.DexMerger.merge(DexMerger.java:189)
at com.android.dx.command.dexer.Main.mergeLibraryDexBuffers(Main.java:454)
at com.android.dx.command.dexer.Main.runMonoDex(Main.java:303)
at com.android.dx.command.dexer.Main.run(Main.java:246)
at com.android.dx.command.dexer.Main.main(Main.java:215)
at com.android.dx.command.Main.main(Main.java:106)
This is my build.gradle file :
apply plugin: 'com.android.application'
android {
compileSdkVersion 21
buildToolsVersion "21.1.2"
defaultConfig {
applicationId "com.genes_x.googleplus"
minSdkVersion 9
targetSdkVersion 21
versionCode 1
versionName "1.0"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
compile 'com.android.support:appcompat-v7:22.0.0'
compile 'com.google.android.gms:play-services:7.0.0'
//compile 'com.google.android.gms:play-services-plus:7.0.0'
//compile 'com.google.android.gms:play-services-identity:7.0.0'
compile files('E:/google plus/GooglePlus/libs/google-play-services.jar')
}
I've been gone through many questions on stackoverflow but didn't get solution. Anything wrong in my build.gradle file..??
The error is pretty obvious. You are compiling google play services twice. Should be:
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
compile 'com.android.support:appcompat-v7:22.0.0'
compile 'com.google.android.gms:play-services:7.0.0'
//compile 'com.google.android.gms:play-services-plus:7.0.0'
//compile 'com.google.android.gms:play-services-identity:7.0.0'
//compile files('E:/google plus/GooglePlus/libs/google-play-services.jar')
}
I have googled to find a solution, but I have tried all the ways and any of them works. First my project works with any problem, later I added some changes and this happened. When I delete all the changes, the problem has not dissapeared. When I try to complie the project, gradle console shows:
FAILURE: Build failed with an exception.
What went wrong:
Execution failed for task ':app:dexDebug'.
> com.android.ide.common.internal.LoggedErrorException: Failed to run command:
/home/user/Android/Sdk/build-tools/22.0.0/dx --dex --no-optimize --output /home/projectpath/app/build/intermediates/dex/debug --input-list=/home/projectpath/app/build/intermediates/tmp/dex/debug/inputList.txt
Error Code:
2
Output:
UNEXPECTED TOP-LEVEL EXCEPTION:
com.android.dex.DexException: Multiple dex files define Lbolts/AggregateException;
at com.android.dx.merge.DexMerger.readSortableTypes(DexMerger.java:596)
at com.android.dx.merge.DexMerger.getSortedTypes(DexMerger.java:554)
at com.android.dx.merge.DexMerger.mergeClassDefs(DexMerger.java:535)
at com.android.dx.merge.DexMerger.mergeDexes(DexMerger.java:171)
at com.android.dx.merge.DexMerger.merge(DexMerger.java:189)
at com.android.dx.command.dexer.Main.mergeLibraryDexBuffers(Main.java:454)
at com.android.dx.command.dexer.Main.runMonoDex(Main.java:303)
at com.android.dx.command.dexer.Main.run(Main.java:246)
at com.android.dx.command.dexer.Main.main(Main.java:215)
at com.android.dx.command.Main.main(Main.java:106)
This is my build.gradle file:
apply plugin: 'com.android.application'
android {
compileSdkVersion 22
buildToolsVersion "22.0.0"
defaultConfig {
applicationId "application.com.name"
minSdkVersion 15
targetSdkVersion 22
versionCode 1
versionName "1.0"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
compile 'com.android.support:appcompat-v7:+'
compile 'com.android.support:palette-v7:+'
compile 'com.android.support:recyclerview-v7:+'
compile 'com.android.support:cardview-v7:22.0.+'
compile 'com.jakewharton:butterknife:5.1.2'
compile 'com.jakewharton.timber:timber:2.5.0'
compile 'fr.tvbarthel.lib.blurdialogfragment:lib:1.1.0#aar'
compile 'com.github.chenupt.android:multiplemodel:1.1.0#aar'
compile 'de.greenrobot:eventbus:2.4.0'
compile 'com.google.guava:guava:18.0'
compile 'com.jpardogo.materialtabstrip:library:1.0.8'
compile 'com.getbase:floatingactionbutton:1.7.0'
compile 'com.squareup.picasso:picasso:2.5.0'
compile 'com.facebook.android:facebook-android-sdk:3.21.1'
}
dependencies {
compile 'com.parse.bolts:bolts-android:1.+'
compile fileTree(dir: 'libs', include: 'Parse-*.jar')
compile fileTree(dir: 'libs', include: 'ParseCrashReporting-*.jar')
}
This kind of issue UNEXPECTED TOP-LEVEL EXCEPTION: com.android.dex.DexException:
happens when you are using the same library with a different version.
The problem is here:
You are using
compile 'com.parse.bolts:bolts-android:1.+'
Currently the version is 1.2
The facebook (3.21.1) library is using the 1.1.2 version
Also you are using
compile 'com.android.support:appcompat-v7:+'
It means the release 22.
The facebook library uses the 20-21.
I was trying to code a simple android app and i get this error message.Please help
Error:Execution failed for task ':app:dexDebug'.
com.android.ide.common.internal.LoggedErrorException: Failed to run command:
D:\Users\user\AppData\Local\Android\sdk\build-tools\21.1.2\dx.bat --dex --no-optimize --output C:\Users\user\Desktop\SocialNetworking\app\build\intermediates\dex\debug --input-list=C:\Users\user\Desktop\SocialNetworking\app\build\intermediates\tmp\dex\debug\inputList.txt
Error Code:
2
Output:
UNEXPECTED TOP-LEVEL EXCEPTION:
com.android.dex.DexException: Multiple dex files define Lbolts/AggregateException;
at com.android.dx.merge.DexMerger.readSortableTypes(DexMerger.java:596)
at com.android.dx.merge.DexMerger.getSortedTypes(DexMerger.java:554)
at com.android.dx.merge.DexMerger.mergeClassDefs(DexMerger.java:535)
at com.android.dx.merge.DexMerger.mergeDexes(DexMerger.java:171)
at com.android.dx.merge.DexMerger.merge(DexMerger.java:189)
at com.android.dx.command.dexer.Main.mergeLibraryDexBuffers(Main.java:454)
at com.android.dx.command.dexer.Main.runMonoDex(Main.java:303)
at com.android.dx.command.dexer.Main.run(Main.java:246)
at com.android.dx.command.dexer.Main.main(Main.java:215)
at com.android.dx.command.Main.main(Main.java:106)
My gradle build is as follows
apply plugin: 'com.android.application'
android {
compileSdkVersion 21
buildToolsVersion "21.1.2"
defaultConfig {
applicationId "jason.orchid.com.socialnetworking"
minSdkVersion 19
targetSdkVersion 21
versionCode 1
versionName "1.0"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
repositories { mavenCentral() }
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
compile 'com.android.support:appcompat-v7:21.0.3'
compile 'com.android.support:support-v4:21.0.3'
compile 'com.parse.bolts:bolts-android:1.1.4'
compile 'com.facebook.android:facebook-android-sdk:3.23.0'
compile 'com.parse.bolts:bolts-android:1.+'
compile fileTree(dir: 'libs', include: 'Parse-*.jar')
}
It is because you have included 'com.parse.bolts:bolts-android:x.x' twice in your dependencies. Remove any one of them and the problem will be resolved.