Execution failed for task app:dexDebug - android

this my gradle file
apply plugin: 'com.android.application'
android {
compileSdkVersion 21
buildToolsVersion "22.0.1"
defaultConfig {
applicationId "done.ui"
minSdkVersion 16
targetSdkVersion 21
versionCode 1
versionName "1.0"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
repositories {
mavenCentral()
maven {
url "https://jitpack.io"
}
}
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
compile 'com.android.support:appcompat-v7:22.2.1'
compile 'com.android.support:recyclerview-v7:22.2.+'
compile 'com.google.android.gms:play-services:7.5.0'
compile 'com.facebook.android:facebook-android-sdk:4.2.0'
compile 'com.pubnub:pubnub-android:3.7.4'
compile 'com.amazonaws:aws-android-sdk-core:2.+'
compile 'com.amazonaws:aws-android-sdk-cognito:2.+'
compile 'com.amazonaws:aws-android-sdk-ddb:2.+'
compile 'com.amazonaws:aws-android-sdk-ddb-mapper:2.+'
compile 'com.android.support:cardview-v7:21.0.+'
compile 'com.github.clans:fab:1.5.5'
compile 'com.melnykov:floatingactionbutton:1.3.0'
compile 'com.github.ksoichiro:android-observablescrollview:1.5.0'
compile 'com.nineoldandroids:library:2.4.0'
compile 'com.github.kanytu:android-parallax-recyclerview:v1.4'
compile files('libs/PayPalAndroidSDK-2.8.5.jar')
}
message gradle build after run project
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.7.0_80\bin\java.exe'' finished with non-zero exit value 2

Try this
You use buildToolsVersion 22 and your compileSdkVersion and targetSdkVersion is 21
apply plugin: 'com.android.application'
android {
compileSdkVersion 22
buildToolsVersion "22.0.1"
defaultConfig {
applicationId "done.ui"
minSdkVersion 16
targetSdkVersion 22
versionCode 1
versionName "1.0"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
repositories {
mavenCentral()
maven {
url "https://jitpack.io"
}
}
dependencies {
compile fileTree(dir: 'libs', exclude: 'android-support-v4.jar', include: ['*.jar'])
compile 'com.android.support:appcompat-v7:22.2.1'
compile 'com.android.support:recyclerview-v7:22.2.+'
compile 'com.google.android.gms:play-services:7.5.0'
compile 'com.facebook.android:facebook-android-sdk:4.2.0'
compile 'com.pubnub:pubnub-android:3.7.4'
compile 'com.amazonaws:aws-android-sdk-core:2.+'
compile 'com.amazonaws:aws-android-sdk-cognito:2.+'
compile 'com.amazonaws:aws-android-sdk-ddb:2.+'
compile 'com.amazonaws:aws-android-sdk-ddb-mapper:2.+'
compile 'com.android.support:cardview-v7:21.0.+'
compile 'com.github.clans:fab:1.5.5'
compile 'com.melnykov:floatingactionbutton:1.3.0'
compile 'com.github.ksoichiro:android-observablescrollview:1.5.0'
compile 'com.nineoldandroids:library:2.4.0'
compile 'com.github.kanytu:android-parallax-recyclerview:v1.4'
compile files('libs/PayPalAndroidSDK-2.8.5.jar')
}

dependencies {
//compile fileTree(dir: 'libs', include: ['*.jar'])//<==Just comment this line
compile 'com.android.support:appcompat-v7:22.2.1'
compile 'com.android.support:recyclerview-v7:22.2.+'
compile 'com.google.android.gms:play-services:7.5.0'
compile 'com.facebook.android:facebook-android-sdk:4.2.0'
compile 'com.pubnub:pubnub-android:3.7.4'
compile 'com.amazonaws:aws-android-sdk-core:2.+'
compile 'com.amazonaws:aws-android-sdk-cognito:2.+'
compile 'com.amazonaws:aws-android-sdk-ddb:2.+'
compile 'com.amazonaws:aws-android-sdk-ddb-mapper:2.+'
compile 'com.android.support:cardview-v7:21.0.+'
compile 'com.github.clans:fab:1.5.5'
compile 'com.melnykov:floatingactionbutton:1.3.0'
compile 'com.github.ksoichiro:android-observablescrollview:1.5.0'
compile 'com.nineoldandroids:library:2.4.0'
compile 'com.github.kanytu:android-parallax-recyclerview:v1.4'
compile files('libs/PayPalAndroidSDK-2.8.5.jar')
}
comment this line and re-build again that's it compile fileTree(dir: 'libs', include: ['*.jar'])
and don't forget to add this
defaultConfig {
...
multiDexEnabled true
}

Use --debug option to get more detailed output.
It is possible that you have dependencies conflict and dex trying to process same class file from different libraries and failing. If this is the case you should filter out libraries you don't need.
use:
compile ("alibpath") {
transitive = false
}
to skip transitive libraries.
The other possibility is that you have java.* javax.* classes in your libs, dex doesn't like it.

Related

Error Buidling APK in android studio 2.3.1

I am trying to build an apk for my project in android studio 2.3.1 but I receive the error below:
Error:Execution failed for task ':Dr_Application:transformClassesWithDexForDebug'.
com.android.build.api.transform.TransformException: com.android.ide.common.process.ProcessException: java.util.concurrent.ExecutionException: com.android.ide.common.process.ProcessException:
Error while executing java process with main class com.android.dx.command.Main with arguments
{--dex --num-threads=4 --multi-dex --main-dex-list C:\Users\Nisile\Desktop\Nguvu Kazi New\code\HandyMan\Dr_Application\build\intermediates\multi-dex\debug\maindexlist.txt --output C:\Users\Nisile\Desktop\Nguvu Kazi New\code\HandyMan\Dr_Application\build\intermediates\transforms\dex\debug\folders\1000\1f\main C:\Users\Nisile\Desktop\Nguvu Kazi New\code\HandyMan\Dr_Application\build\intermediates\transforms\jarMerging\debug\jars\1\1f\combined.jar}
my build.gradle is:
apply plugin: 'com.android.application'
android {
compileSdkVersion 25
buildToolsVersion "25.0.1"
useLibrary 'org.apache.http.legacy'
defaultConfig {
applicationId "com.bluehorntech.drapplication"
minSdkVersion 10
targetSdkVersion 25
versionCode 1
versionName "1.0"
multiDexEnabled true
}
dexOptions {
javaMaxHeapSize "2g"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
repositories {
maven { url "https://raw.githubusercontent.com/smilefam/SendBird-SDK-Android/master/" }
}
dependencies {
compile 'com.mcxiaoke.volley:library:1.0.6#aar'
compile files('libs/httpmime-4.1.3.jar')
compile 'com.android.support:multidex:1.0.1'
compile project(':datetimepicker-library')
compile fileTree(include: ['*.jar'], dir: 'libs')
// compile files('src/libs/org.apache.http.legacy.jar')
// compile fileTree(dir: 'libs', include: 'Parse-*.jar')
compile project(':library')
//noinspection GradleCompatible
compile 'com.android.support:appcompat-v7:23.1.1'
compile 'com.android.support:recyclerview-v7:23.1.1'
compile 'com.android.support:cardview-v7:23.1.1'
// compile 'com.parse.bolts:bolts-android:1.+'
compile 'com.google.android.gms:play-services:9.0.0'
compile 'com.jakewharton:butterknife:5.1.1'
compile 'com.google.android.gms:play-services-ads:9.0.0'
compile 'com.google.android.gms:play-services-auth:9.0.0'
compile 'com.google.android.gms:play-services-gcm:9.0.0'
compile 'com.google.firebase:firebase-core:9.0.0'
compile 'com.squareup.okhttp3:okhttp:3.2.0'
compile 'com.sendbird.sdk:sendbird-android-sdk:3.0.10'
/*ald*/
compile 'com.nineoldandroids:library:2.4.0'
compile 'com.github.sd6352051.niftydialogeffects:niftydialogeffects:1.0.0#aar'
}
apply plugin: 'com.google.gms.google-services'
I read and tried every possible solution from former threads but still cannot resolve my problem. Please help.
Use this build and clean project

Gradle MultiDex duplicate entry error

I am trying to integrate firebase into my android app, but I am receiving this error:
Execution failed for task ':app:packageAllDebugClassesForMultiDex'.
> java.util.zip.ZipException: duplicate entry: com/google/android/gms/internal/zzrs.class
This is my app level build.gradle:
apply plugin: 'com.android.application'
android {
compileSdkVersion 23
buildToolsVersion "23.0.1"
defaultConfig {
applicationId "com.example.evan.scout"
minSdkVersion 16
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.instabug.library:instabug:2.3.1'
compile 'com.android.support:appcompat-v7:23.1.0'
compile 'com.google.code.gson:gson:2.2.4'
compile 'com.google.firebase:firebase-database:9.4.0'
compile 'com.google.firebase:firebase-auth:9.4.0'
compile 'com.google.firebase:firebase-config:9.4.0'
}
apply plugin: 'com.google.gms.google-services'
I do not even see a zzrs.class file
Thanks
try this:
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
testCompile 'junit:junit:4.12'
compile 'com.instabug.library:instabug:2.3.1'
compile 'com.android.support:appcompat-v7:23.1.0'
compile 'com.google.code.gson:gson:2.2.4'
compile 'com.google.firebase:firebase-database:9.4.0'
compile 'com.google.firebase:firebase-auth:9.4.0'
compile 'com.google.firebase:firebase-config:9.4.0'
exclude group: 'com.google.android.gms'
}

"Method references in a .dex file cannot exceed 64K" after changing build.gradle

I'm getting that error that says I have too many method references:
Error:The number of method references in a .dex file cannot exceed 64K.
It all started when I tried to change my targetSdkVersion to 24 and minSdkVersion to a lower sdk (19) via the gradle app file. That led me to having to change some values throughout the file like
compile 'com.android.support:appcompat-v7:23.0.0'
to
compile 'com.android.support:appcompat-v7:24.1.1'
I've read that people get this error when they have the wrong values in build.gradle. Here was my original build.gradle before the changes:
apply plugin: 'com.android.application'
android {
compileSdkVersion 23
buildToolsVersion "23.0.3"
defaultConfig {
applicationId "com.delbridge.seth.alarm"
minSdkVersion 23
targetSdkVersion 23
versionCode 1
versionName "1.0"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'),
'proguard-rules.pro'
}
debug {
debuggable true
}
}
}
Any thoughts as to what's causing this?
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
testCompile 'junit:junit:4.12'
compile 'com.android.support:appcompat-v7:23.0.0'
compile 'com.mcxiaoke.volley:library-aar:1.0.0'
compile 'org.jsoup:jsoup:1.9.2'
compile 'org.jdeferred:jdeferred-android-aar:1.2.4'
compile 'com.google.android.gms:play-services-appindexing:9.0.2'
compile 'com.google.android.gms:play-services:9.0.2'
compile 'com.android.support:support-v4:23.0.0'
compile 'com.android.support:design:23.0.0'
compile 'com.android.support:cardview-v7:23.0.+'
compile 'com.android.support:recyclerview-v7:23.0.+'
compile 'com.google.firebase:firebase-ads:9.0.2'
}
apply plugin: 'com.google.gms.google-services'
And here is my build.gradle currently:
apply plugin: 'com.android.application'
android {
compileSdkVersion 24
buildToolsVersion "23.0.3"
defaultConfig {
applicationId "com.delbridge.seth.alarm"
minSdkVersion 19
targetSdkVersion 24
versionCode 1
versionName "1.0"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
debug {
debuggable true
}
}
}
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
testCompile 'junit:junit:4.12'
compile 'com.android.support:appcompat-v7:24.1.1'
compile 'com.mcxiaoke.volley:library-aar:1.0.0'
compile 'org.jsoup:jsoup:1.9.2'
compile 'org.jdeferred:jdeferred-android-aar:1.2.4'
compile 'com.google.android.gms:play-services-appindexing:9.4.0'
compile 'com.google.android.gms:play-services:9.4.0'
compile 'com.google.firebase:firebase-ads:9.4.0'
compile 'com.google.android.gms:play-services-ads:9.4.0'
compile 'com.google.android.gms:play-services-auth:9.4.0'
compile 'com.google.android.gms:play-services-gcm:9.4.0'
compile 'com.android.support:support-v4:24.1.1'
compile 'com.android.support:design:24.1.1'
compile 'com.android.support:cardview-v7:24.1.1'
compile 'com.android.support:recyclerview-v7:24.1.1'
}
apply plugin: 'com.google.gms.google-services'
You're unnecessarily including all of Google Play Services with this line:
compile 'com.google.android.gms:play-services:9.4.0'
So, remove that line and leave the ones that include the individual components:
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
testCompile 'junit:junit:4.12'
compile 'com.android.support:appcompat-v7:24.1.1'
compile 'com.mcxiaoke.volley:library-aar:1.0.0'
compile 'org.jsoup:jsoup:1.9.2'
compile 'org.jdeferred:jdeferred-android-aar:1.2.4'
compile 'com.google.android.gms:play-services-appindexing:9.4.0'
//remove this line:
//compile 'com.google.android.gms:play-services:9.4.0'
compile 'com.google.firebase:firebase-ads:9.4.0'
compile 'com.google.android.gms:play-services-ads:9.4.0'
compile 'com.google.android.gms:play-services-auth:9.4.0'
compile 'com.google.android.gms:play-services-gcm:9.4.0'
compile 'com.android.support:support-v4:24.1.1'
compile 'com.android.support:design:24.1.1'
compile 'com.android.support:cardview-v7:24.1.1'
compile 'com.android.support:recyclerview-v7:24.1.1'
}
Note:
If the above solution does not solve your issue, then you will need to enable multidex.
try this in your build.gradle file:
android {
compileSdkVersion 22
buildToolsVersion "23.0.0"
defaultConfig {
minSdkVersion 14 //lower than 14 doesn't support multidex
targetSdkVersion 22
// Enabling multidex support.
multiDexEnabled true
}
}
dependencies {
compile 'com.android.support:multidex:1.0.1'
}
check this page: https://developers.google.com/android/guides/setup
and use needed google play service

Error:(44, 13) Failed to resolve: com.github.nukc.loadmorelayout:library:0.1.0

http://search.maven.org/
image
I am getting the above error while importing the library from compiler
com.github.nukc.loadmorelayout:library:0.1.0
Error:(44, 13) Failed to resolve: com.github.nukc.loadmorelayout:library:0.1.0
My build.gradle :
apply plugin: 'com.android.application'`
android {
compileSdkVersion 23
buildToolsVersion "23.0.1"
useLibrary 'org.apache.http.legacy'
defaultConfig {
applicationId "com.demo.android"
minSdkVersion 15
targetSdkVersion 23
versionCode 3
versionName "2.1"
}
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:23.0.1'
compile 'com.android.support:appcompat-v7:23.0.1'
compile 'com.android.support:design:23.0.1'
compile 'com.android.support:support-annotations:23.0.1'
compile 'com.android.support:recyclerview-v7:23.0.1'
compile 'com.jakewharton:butterknife:7.0.1'
compile 'com.google.code.gson:gson:2.3.1'
compile 'com.mcxiaoke.volley:library:1.0.19'
compile 'com.squareup.okhttp:okhttp:2.5.0'
repositories {
mavenCentral()
}
compile 'com.sothree.slidinguppanel:library:3.1.1'
compile 'de.hdodenhof:circleimageview:2.0.0'
compile 'com.github.bumptech.glide:glide:3.6.1'
compile 'de.greenrobot:eventbus:2.4.0'
compile 'com.github.nukc.loadmorelayout:library:0.1.0'
}
You can use this instead of yours.
compile 'com.nukc.loadmorelayout:library:0.1'

issue Execution failed for task ':app:dexDebug'. finished with non-zero exit value 2

I make one project like below structure
my build.gradel file as below
apply plugin: 'com.android.application'
android {
compileSdkVersion 22
buildToolsVersion "22.0.1"
defaultConfig {
applicationId "pkg.com.appname"
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:22.2.1'
compile files('libs/commons-io-2.4.jar')
compile files('libs/achartengine-1.1.0.jar')
compile files('libs/apache-mime4j-0.6.jar')
compile files('libs/itextpdf-5.1.0.jar')
compile files('libs/android-support-v4.jar')
compile files('libs/gson-2.1.jar')
compile files('libs/json_simple-1.1.jar')
compile files('libs/httpmime-4.0.1.jar')
compile files('libs/droidText.0.2.jar')
compile files('libs/ormlite-android-4.48.jar')
compile files('libs/opencsv-2.4.jar')
compile files('libs/ormlite-core-4.48.jar')
compile 'com.google.android.gms:play-services:7.5.0'
}
I tried all possibility as per current accepted answer like below
1. Comment dependency lib line form build.gradle
dependencies {
/*compile fileTree(dir: 'libs', include: ['*.jar'])*/
compile 'com.android.support:appcompat-v7:22.2.1'
compile files('libs/commons-io-2.4.jar')
compile files('libs/achartengine-1.1.0.jar')
compile files('libs/apache-mime4j-0.6.jar')
compile files('libs/itextpdf-5.1.0.jar')
compile files('libs/android-support-v4.jar')
compile files('libs/gson-2.1.jar')
compile files('libs/json_simple-1.1.jar')
compile files('libs/httpmime-4.0.1.jar')
compile files('libs/droidText.0.2.jar')
compile files('libs/ormlite-android-4.48.jar')
compile files('libs/opencsv-2.4.jar')
compile files('libs/ormlite-core-4.48.jar')
compile 'com.google.android.gms:play-services:7.5.0'
}
but if i remove this than in my class file getting error like your library is missing for this class
2. By making change line as compile to provided
when i making above change than my application not run and give message like like null pointer due to library not getting to respective class.
So i m getting confuse which way i follow for this any idea how can i solve this problem? your all suggestions are appreciable.
In defaultConfig add :
multiDexEnabled = true
And in same build.gradle add :
dexOptions {
javaMaxHeapSize "4g"
}
And in dependencies add :
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
compile 'com.android.support:multidex:1.0.0'}

Categories

Resources