Picasso causes Execution failed for task ':app:dexDebug' - android

I'm using Android studio and I'm trying to add Picasso library to my project, but whenever I try to run the app I'm having this error
Error:Execution failed for task ':app:dexDebug'.
com.android.ide.common.process.ProcessException: org.gradle.process.internal.ExecException: Process 'command '/Library/Java/JavaVirtualMachines/jdk1.8.0_25.jdk/Contents/Home/bin/java'' finished with non-zero exit value 2
Here is my Gradle file
apply plugin: 'com.android.application'
android {
compileSdkVersion 22
buildToolsVersion "22.0.0"
defaultConfig {
applicationId "com.example"
minSdkVersion 15
targetSdkVersion 22
versionCode 1
versionName "1.0"
}
buildTypes {
release {
minifyEnabled true
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.facebook.android:facebook-android-sdk:3.21.1'
//TODO::Update to the latest version of Play Service
compile 'com.google.android.gms:play-services:6.5.87'
compile 'com.lorentzos.swipecards:library:1.0.8'
compile 'com.android.support:support-v4:22.0.0'
compile 'ch.halarious:halarious-core:0.11'
compile 'com.google.code.gson:gson:2.3.1'
compile 'com.nostra13.universalimageloader:universal-image-loader:1.9.3'
compile 'com.soundcloud.android:android-crop:0.9.10#aar'
compile 'de.hdodenhof:circleimageview:1.2.2'
compile 'commons-io:commons-io:2.0.1'
compile 'com.integralblue:httpresponsecache:1.0.0'
compile 'com.koushikdutta.ion:ion:2.1.3’
//Here is the Picasso compile line
compile 'com.squareup.picasso:picasso:2.3.3'
}
I' using the latest version of JDK for Mac "jdk-8u45-macosx-x64". BTW, I have tried those solutions (Clean, Build, restart) so no need to suggest them
Thanks in advance

May you are facing the 65k method limit problem.
https://developer.android.com/tools/building/multidex.html
please put this in your default Config:
default Config {
minSdkVersion 14
targetSdkVersion 21
// Enabling multidex support.
multiDexEnabled true
}
and try again

Related

Gradle Failed: transformClassesWithDexForDebug with jdk 1.8

All day I have a challenge with resolve update of some dependencies in my new project.
This is my build.gradle:
apply plugin: 'com.android.application'
android {
compileSdkVersion 24
buildToolsVersion "24.0.3"
defaultConfig {
applicationId "com...."
minSdkVersion 19
targetSdkVersion 24
versionCode 1
versionName "1.0"
}
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:24.2.1'
compile 'com.google.firebase:firebase-database:9.6.1'
compile 'com.google.firebase:firebase-storage:9.6.1'
compile 'com.firebaseui:firebase-ui:0.4.3'
compile 'com.firebase:firebase-client-android:2.3.1'
compile 'com.google.android.gms:play-services:9.6.1'
}
apply plugin: 'com.google.gms.google-services'
and error is:
Error:
"Execution failed for task: ':app:transformClassesWithDexForDebug'
> com.android.build.api.transform.TransformException: com.android.ide.common.process.ProcessException: org.gradle.process.internal.ExecException: Process 'command '/Library/Java/JavaVirtualMachines/jdk1.8.0_101.jdk/Contents/home/bin/java" finished with non zero-exit value 2
The problem was showing when I tried to upload an image to Firebase storage. There was error with an internet connection etc. I decided to make update of libraries. After this there is an error with jdk 1.8.
Could somebody help me to resolve this challenge?
Regards
Basically you would also want to check and resolve version conflicts in your app's dependencies.
Also check if you have enabled multidex in your app.
I had a similar issue. In my app I am using guava-retrying library, which was fetching google guava library version 21. Guava version 21 requires JDK 1.8 without providing back porting support and this was causing this error in my case.
I was able to solve it by including the guava-retrying library so that it uses version 19.0 of guava library:
compile ("com.github.rholder:guava-retrying:2.0.0") {
exclude group: 'com.google.guava', module: 'guava'
}
compile 'com.google.guava:guava:19.0'
I believe you need to enable Multidex for your application.
add the Multidex library to your dependencies, then enable Multidex in defaultConfig.
Example:
android {
compileSdkVersion 24
buildToolsVersion "24.0.3"
defaultConfig {
applicationId "com...."
minSdkVersion 19
targetSdkVersion 24
versionCode 1
versionName "1.0"
// Enabling multidex support.
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:24.2.1'
compile 'com.google.firebase:firebase-database:9.6.1'
compile 'com.google.firebase:firebase-storage:9.6.1'
compile 'com.firebaseui:firebase-ui:0.4.3'
compile 'com.firebase:firebase-client-android:2.3.1'
compile 'com.google.android.gms:play-services:9.6.1'
compile 'com.android.support:multidex:1.0.0'
}
Then in `AndroidManifest.xml", enable Multidex installation:
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.example.android.multidex.myapplication">
<application
...
android:name="android.support.multidex.MultiDexApplication">
...
</application>
</manifest>
Source: https://developer.android.com/studio/build/multidex.html#mdex-gradle

Error in compile SDK version?

Can anyone please tell me how do i fix this error:
apply plugin: 'com.android.application'
android {
compileSdkVersion 21
buildToolsVersion '21.1.2'
defaultConfig {
applicationId "com.example.abhishek.detector"
minSdkVersion 10
targetSdkVersion 21
versionCode 1
versionName "1.0"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
productFlavors {
}
}
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
testCompile 'junit:junit:4.12'
compile 'com.android.support:appcompat-v7:23.1.0'
compile 'com.android.support:design:23.1.0'
compile 'com.google.android.gms:play-services-location:8.1.0'
}
Error:
Error:Execution failed for task ':app:processDebugResources'.
com.android.ide.common.process.ProcessException: org.gradle.process.internal.ExecException: Process 'command 'C:\Users\hp-pc\AppData\Local\Android\sdk\build-tools\21.1.2\aapt.exe'' finished with non-zero exit value 1
Install the latest version of the build tools. Adjust your build.gradle to use
`buildToolsVersion "23.0.2"`
or check and remove duplicate dependencies from list.
Enjoy :)
Change the sdk version from the values/string.xml

Android : Error:Execution failed for task ':app:processDebugResources' exit with non-Zero Value 1

Am getting error when I rebuild the project. After I add the dependency for the google Map V2 this error occur.
Error:Execution failed for task ':app:processDebugResources'.
> com.android.ide.common.process.ProcessException: org.gradle.process.internal.ExecException:
Process 'command 'C:\Users\Binil\AppData\Local\Android\sdk\build-tools\22.0.1\aapt.exe'' finished with non-zero exit value 1
I tried to clean the project and rebuild the project but same issue occur again. Also I try sync the project but not solved
compile 'com.google.android.gms:play-services:8.4.0'
When I remove this dependency then app build successfully.
Gradle.build
apply plugin: 'com.android.application'
android {
compileSdkVersion 22
buildToolsVersion "22.0.1"
defaultConfig {
applicationId "com.android4dev.navigationview"
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.0'
compile 'com.android.support:design:22.2.0'
compile 'de.hdodenhof:circleimageview:1.3.0'
compile 'com.google.android.gms:play-services:8.4.0'
}
Can any one please help me.
Add this with-in android tag to your module build.gradle:
dexOptions {
javaMaxHeapSize "4g"
}
Also, if you only want to use maps try to add this
compile 'com.google.android.gms:play-services-maps:8.4.0'
Instead of
compile 'com.google.android.gms:play-services:8.4.0'
Add apply plugin com.google.gms.google-services after dependencies
dependencies
{
compile 'com.google.android.gms:play-services:8.4.0'
}
apply plugin: 'com.google.gms.google-services'

Two libraries have same values.xml

I am making an Andoird app in which I have used many dependencies and I need all the dependencies.but an error has encountered stating that rippleColor has already been defined.
I have searched on the internet all I have found is that my dependencies have same name in values.xml.
Error1:-
Attribute "rippleColor" has already been defined
Error2:-
Error:Execution failed for task ':app:processDebugResources'.
com.android.ide.common.process.ProcessException: org.gradle.process.internal.ExecException: Process 'command 'C:\Users\RANJEET JAIN\AppData\Local\Android\sdk\build-tools\22.0.1\aapt.exe'' finished with non-zero exit value 1
My gradle
apply plugin: 'com.android.application'
android {
compileSdkVersion 22
buildToolsVersion "22.0.1"
defaultConfig {
applicationId "ranjeet.example.com.finance"
minSdkVersion 14
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.github.navasmdc:MaterialDesign:1.5#aar'
compile 'com.android.support:appcompat-v7:22.2.1'
compile 'com.parse:parse-android:1.10.2'
compile 'info.hoang8f:fbutton:1.0.5'
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.android.support:recyclerview-v7:22.2.1'
compile 'com.android.support:design:22.2.1'
}

Google App Engine Gradle Dependency Conflict

I'm facing a problem with my dependencies in my app that will not let me add my endpoints-backend module as a dependency to my app module like so:
When I compile, it gives me this error:
Error:Execution failed for task ':app:preDexDebug'. >com.android.ide.common.process.ProcessException: org.gradle.process.internal.ExecException: Process 'command '/Library/Java/JavaVirtualMachines/jdk1.8.0_25.jdk/Contents/Home/bin/java'' finished with non-zero exit value 3
When I remove the endpoints-backend dependency, the program runs, but I need it as a dependency so I can access the endpoints code inside my MainActivity.
Here's my Gradle
apply plugin: 'com.android.application'
android {
compileSdkVersion 21
buildToolsVersion "21.1.2"
defaultConfig {
applicationId "com.blume.android"
minSdkVersion 14
targetSdkVersion 21
versionCode 1
versionName "1.0"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
compile project(path: ':endpoints-backend', configuration: 'android-endpoints')
compile 'com.android.support:appcompat-v7:21.0.3'
compile 'com.google.android.gms:play-services:6.5.87'
compile project(path: ':cloud-backend', configuration: 'android-endpoints')
compile 'javax.persistence:persistence-api:1.0'
compile project(':endpoints-backend')
}
All Help is appreciated!
You should remove this line:
compile project(':endpoints-backend')
You have it included here:
compile project(path: ':endpoints-backend', configuration: 'android-endpoints')

Categories

Resources