android: Execution failed for task ':app:dexDebug' zxing barcode scanner - java

i am trying to use dm77/barcodescanner zxing from github and i've been trying to use this library but i always get
Error:Execution failed for task ':app:dexDebug'.
com.android.ide.common.process.ProcessException: org.gradle.process.internal.ExecException: Process 'command 'C:\Program Files\Java\jdk1.8.0_60\bin\java.exe'' finished with non-zero exit value 2
i've searched to other app:dex:Debug questions and problems and they said that i may have multiple dependencies. i tried to check it but i can't detect what or where these "multiple dependencies" are.
here's my code:
apply plugin: 'com.android.application'
android {
compileSdkVersion 23
buildToolsVersion "23.0.2"
defaultConfig {
applicationId "com.quest.questsuser"
minSdkVersion 18
targetSdkVersion 23
versionCode 1
versionName "1.0"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
dexOptions {
javaMaxHeapSize "4g"
}
}
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
testCompile 'junit:junit:4.12'
compile 'com.android.support:recyclerview-v7:23.1.1'
compile 'com.google.android.gms:play-services:8.3.0'
compile 'com.android.support:cardview-v7:23.1.1'
compile 'com.android.support:design:23.1.1'
compile 'com.akexorcist:RoundCornerProgressBar:2.0.3'
compile 'com.github.ksoichiro:Android-ObservableScrollView:v1.6.0'
compile 'com.melnykov:floatingactionbutton:1.0.7'
compile 'com.nineoldandroids:library:2.4.0'
compile 'com.daimajia.easing:library:1.0.1#aar'
compile 'com.daimajia.androidanimations:library:1.1.3#aar'
compile 'com.parse.bolts:bolts-android:1.+'
compile 'com.parse:parse-android:1.12.0'
compile 'me.dm7.barcodescanner:zxing:1.8.4'
}
repositories {
maven {
url "https://jitpack.io"
}
}
your help with be greatly appreciated.

I've already found the solution from https://www.youtube.com/watch?v=7uzWEjTVLQ4.
1. I added multiDexEnabled true in the default config build.gradle, added compile 'com.android.support:multidex:1.0.0' in the dependencies and in my Application Class i added a MultiDex.install(this); in the onCreate method

Related

Error during Building an APK file in Android Studio

I was trying to build an apk for my project but i am facing this error and
Error:Execution failed for task
':app:transformClassesWithDexForDebug'.
com.android.build.api.transform.TransformException: com.android.ide.common.process.ProcessException:
java.util.concurrent.ExecutionException: com.android.dex.DexException:
Multiple dex files define Lcom/google/android/gms/internal/zzajl;
i also added multiDexEnabled true but still getting error
Error:Execution failed for task
':app:transformClassesWithJarMergingForDebug'.
com.android.build.api.transform.TransformException: java.util.zip.ZipException: duplicate entry:
com/google/android/gms/internal/zzaix.class
Below is my Build.gradle file
apply plugin: 'com.android.application'
android {
compileSdkVersion 25
buildToolsVersion "25.0.2"
defaultConfig {
applicationId "in.package.name"
minSdkVersion 14
targetSdkVersion 25
versionCode 1
versionName "1.0"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
multiDexEnabled true
}
dexOptions {
javaMaxHeapSize "4g"
}
buildTypes {
release {
minifyEnabled true
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', {
exclude group: 'com.android.support', module: 'support-annotations'
})
compile 'com.android.support:appcompat-v7:25.3.1'
compile 'com.android.support.constraint:constraint-layout:1.0.2'
compile 'com.google.android.gms:play-services-ads:11.0.1'
testCompile 'junit:junit:4.12'
// Adding support library for this demo app
compile 'com.android.support:design:25.3.1'
compile 'com.android.support:multidex:1.0.1'
compile 'com.google.firebase:firebase-database:9.6.1'
}
apply plugin: 'com.google.gms.google-services'
Please suggest me some solution
Thanks
Use SAME version
compile 'com.google.android.gms:play-services-ads:11.0.1'
compile 'com.google.firebase:firebase-database:11.0.1'
Then Clean-Rebuild and Restart IDE .
Try cleaning the project first - ./gradlew clean

Getting error "Execution failed for task ':app:transformClassesWithDexForDebug"

Need help.
Error:Execution failed for task ':app:transformClassesWithDexForDebug'. > com.android.build.api.transform.TransformException: com.android.ide.common.process.ProcessException: java.util.concurrent.ExecutionException: com.android.dex.DexException: Multiple dex files define Lcom/google/android/gms/inte
The application runs on api level 23 but gives the above error for api 16 which is my minsdk.
my gradle file :
apply plugin: 'com.android.application'
android {
compileSdkVersion 25
buildToolsVersion "25.0.2"
defaultConfig {
applicationId "com.example.raghavkishan.financialplanner"
minSdkVersion 16
targetSdkVersion 25
versionCode 1
versionName "1.0"
testInstrumentationRunner
"android.support.test.runner.AndroidJUnitRunner"
vectorDrawables.useSupportLibrary = true
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'),
'proguard-rules.pro'
}
}
}
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2',
{
exclude group: 'com.android.support', module: 'support-annotations'
})
compile 'com.android.support:appcompat-v7:25.3.1'
compile 'com.android.support:design:25.3.1'
compile 'com.android.support:support-vector-drawable:25.3.1'
compile 'com.google.firebase:firebase-auth:10.2.1'
compile 'com.google.firebase:firebase-database:10.0.1'
compile 'com.google.android.gms:play-services-auth:10.2.1'
compile 'com.android.support.constraint:constraint-layout:1.0.2'
testCompile 'junit:junit:4.12'
}
apply plugin: 'com.google.gms.google-services'
Thanks.
First clean project and rebuild,then add following code in your project's app level build.gradle file:
defaultConfig {
multiDexEnabled true
}
In your build.gradle file,
dependencies contains following lines:
compile 'com.google.firebase:firebase-auth:10.2.1'
compile 'com.google.firebase:firebase-database:10.0.1'
compile 'com.google.android.gms:play-services-auth:10.2.1'
Instead this change to following lines:
compile 'com.google.firebase:firebase-auth:10.2.1'
compile 'com.google.firebase:firebase-database:10.2.1'
compile 'com.google.android.gms:play-services-auth:10.2.1'
just make sure each version have same values.

Java util ConcurrentException: ProcessException in android

I am getting frustrated. Everything was fine in my project. Then i wanted to implement google custom tab and added dependency. But as soon as I sync the project it is showing the error. I tried to remove the dependency but still the problem is occurring. I have searched in google and stackoverflow. All i got is about multiDex. I have added that too but nothing is changed.
The error and stack trace:
Information:Gradle tasks [:app:generateDebugSources, :app:generateDebugAndroidTestSources, :app:mockableAndroidJar, :app:prepareDebugUnitTestDependencies]
Error:java.util.concurrent.ExecutionException: com.android.ide.common.process.ProcessException:
Error:Execution failed for task ':app:mergeDebugResources'.
Error: java.util.concurrent.ExecutionException: com.android.ide.common.process.ProcessException:
The dependency code:
apply plugin: 'com.android.application'
apply plugin: 'android-apt'
apply plugin: 'realm-android'
android {
compileSdkVersion 24
buildToolsVersion "24.0.2"
defaultConfig {
applicationId "razon.tasktodo"
minSdkVersion 16
targetSdkVersion 24
versionCode 1
versionName "1.0"
multiDexEnabled true
}
buildTypes {
release {
minifyEnabled true
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', {
exclude group: 'com.android.support', module: 'support-annotations'
})
repositories {
mavenCentral()
maven {
url 'http://dl.bintray.com/gigamole/maven/'
}
maven { url "https://jitpack.io" }
}
compile 'com.android.support:design:24.2.1'
compile 'com.android.support:appcompat-v7:24.2.1'
compile 'com.github.rey5137:material:1.2.4'
compile 'com.github.halysongoncalves:pugnotification:1.8.1'
compile 'me.drakeet.materialdialog:library:1.3.1'
compile 'com.github.devlight.navigationtabstrip:navigationtabstrip:+'
compile 'com.android.support:support-v4:24.2.1'
compile 'com.jakewharton:butterknife:8.1.0'
compile 'jp.wasabeef:recyclerview-animators:2.2.5'
compile 'com.github.armcha:SpaceNavigationView:1.5.0'
compile 'com.github.devlight:infinitecycleviewpager:1.0.2'
compile 'com.android.support:multidex:1.0.1'
testCompile 'junit:junit:4.12'
apt 'com.jakewharton:butterknife-compiler:8.1.0'
}
Please help me to get rid of it.

MongoDB Java Driver version 3.x.x error on Android

I have problem with compile 'org.mongodb:mongo-java-driver:3.x.x' on Android Studion. I am getting this error:
Error:Execution failed for task ':app:dexDebug'.
com.android.ide.common.process.ProcessException: org.gradle.process.internal.ExecException: Process 'command 'C:\Program Files\Java\jdk1.8.0_25\bin\java.exe'' finished with non-zero exit value 2
The error do not appear with 'org.mongodb:mongo-java-driver:2.x.x' So i suppose that it is rather a jdk problem or a problem from mongo driver version 3.x.x.
Here is my gradle file too.
apply plugin: 'com.android.application'
android {
compileSdkVersion 23
buildToolsVersion "23.0.2"
useLibrary 'org.apache.http.legacy'
repositories {
mavenCentral()
jcenter()
}
defaultConfig {
applicationId "com.example.irakl_000.maps"
minSdkVersion 19
targetSdkVersion 23
versionCode 1
versionName "1.0"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
//compile fileTree(include: ['*.jar'], dir: 'libs')
testCompile 'junit:junit:4.12'
compile 'com.android.support:appcompat-v7:23.1.0'
compile 'com.google.android.gms:play-services:8.3.0'
compile 'com.android.support:design:23.1.0'
//compile 'com.android.support:percent:23.1.0'
compile 'com.facebook.android:facebook-android-sdk:4.7.0'
compile 'de.hdodenhof:circleimageview:2.0.0'
compile 'com.isseiaoki:simplecropview:1.0.13'
compile 'org.mongodb:mongo-java-driver:2.9.2' //.....//
}
EDIT:
On a new project the version 3.x.x has no errors on gradle. So jdk should not be a problem. So could it be some kind of limit on size of compile file error like the 65K Limit error?

Error:Execution failed for task ':app:preDexDebug'. > ... finished with non-zero value 1

I add a library to my project,but the library has some jar packages that i have used in my app,so it comes out the error "finished with non-zero value 2",after i modify the jar packages version,it comes out the error "Error:Execution failed for task ':app:preDexDebug'. > ... finished with non-zero value 1",i dont konw how to solve it 。
the app buidle.gradle :
`apply plugin: 'com.android.application'
android {
packagingOptions{
exclude 'META-INF/LICENSE.txt'
exclude 'META-INF/NOTICE.txt'
}
lintOptions {
abortOnError false
}
compileSdkVersion 21
buildToolsVersion "21.1.2"
defaultConfig {
applicationId "com.example.fengmanlou.logintest"
minSdkVersion 14
targetSdkVersion 21
versionCode 2
versionName "2.0"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
compile 'com.android.support:support-v4:22.0.0'
compile project(':slibingtab')
compile project(':leanchatlib')
compile files('libs/weibo.sdk.android.sso.jar')
compile files('libs/Java-WebSocket-1.2.0-leancloud.jar')
compile files('libs/qq.sdk.1.6.1.jar')
compile files('libs/httpmime-4.2.4.jar')
compile files('libs/fastjson-1.1.37-leancloud.jar')
compile files('libs/avoscloud-statistics-v3.1.1.jar')
compile files('libs/avoscloud-sdk-v3.1.4.jar')
compile files('libs/avoscloud-push-v3.1.4.jar')
compile files('libs/android-async-http-1.4.6.jar')
compile files('libs/android_api_1.1_forsdk.jar')
compile files('libs/BaiduLBS_Android.jar')
compile files('libs/galaxy_mini.jar')
compile files('libs/universal-image-loader-1.9.3.jar')
compile files('libs/avoscloud-sns-v3.1.1.jar')
compile files('libs/avoscloud-search-v3.1.1.jar')
compile files('libs/weibosdkcore.jar')
compile files('libs/litepal.xml-1.2.0.jar')
compile project(':pulltorefresh')
compile files('libs/avoscloud-feedback-v3.1.1.jar')
compile files('libs/jsoup-1.8.1.jar')
compile project(':slibingmenu')
} `
the library build.gradle :
apply plugin: 'com.android.library'
android {
compileSdkVersion 21
buildToolsVersion "21.1.2"
defaultConfig {
minSdkVersion 14
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:support-v4:22.0.0'
compile files('libs/android-async-http-1.4.6.jar')
compile files('libs/avoscloud-push-v3.1.4.jar')
compile files('libs/avoscloud-sdk-v3.1.4.jar')
compile files('libs/butterknife-6.1.0.jar')
compile files('libs/eventbus-2.4.0.jar')
compile files('libs/fastjson-1.1.37-leancloud.jar')
compile files('libs/httpmime-4.2.4.jar')
compile files('libs/Java-WebSocket-1.2.0-leancloud.jar')
compile files('libs/prettytime-3.2.5.Final.jar')
compile files('libs/universal-image-loader-1.9.3.jar')
}
this is the first time i use stackoverflow to ash question,please tell me how to solve it .thank you!
I also dont know how to solve the problem.but the project is built successfully.There is a jar package that cant be opened. I delete it and add the jar package from other project.it works.

Categories

Resources