3

I am trying to add the iTextPDF library to a Android project using Android Studio (gradle). I add the library with compile 'com.itextpdf:itextpdf:5.5.6' instruction but I am getting an error:

Error:Execution failed for task ':app:dexDebug'. com.android.ide.common.process.ProcessException: org.gradle.process.internal.ExecException: Process 'command '/opt/jdk1.7.0_79/bin/java'' finished with non-zero exit value 2

My build.gradle is:

apply plugin: 'com.android.application'

android {
 compileSdkVersion 22
 buildToolsVersion "21.1.2"

defaultConfig {
    applicationId "josealopez.com.software"
    minSdkVersion 14
    targetSdkVersion 22
    versionCode 104
    versionName "1.0.4"
}
buildTypes {
    release {
        minifyEnabled false
        proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
    }
}
packagingOptions {
    exclude 'META-INF/ASL2.0'
    exclude 'META-INF/LICENSE'
    exclude 'META-INF/NOTICE'
}
}
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
compile 'com.android.support:appcompat-v7:22.0.0'
compile 'com.couchbase.lite:couchbase-lite-android:1.0.4'
compile 'com.google.code.gson:gson:2.3.1'
compile 'com.google.android.gms:play-services:7.0.0'
compile 'com.itextpdf:itextpdf:5.5.6'
}
Jose A Lopez Pastor
  • 337
  • 2
  • 4
  • 16

4 Answers4

2

I put these two dependencies in the gradle:

compile 'com.itextpdf:itext-pdfa:5.5.10'
compile 'com.itextpdf:itextg:5.5.9'
2

Use these dependencies:

compile 'com.itextpdf:itext-pdfa:5.5.10'
compile 'com.itextpdf:itextg:5.5.10'
compile group: 'com.itextpdf.tool', name: 'xmlworker', version: '5.5.10'
1

I have this issue try 5.5.10 it worked for me

compile 'com.itextpdf:itextg:5.5.10'
Ahmed Ashour
  • 5,179
  • 10
  • 35
  • 56
Amirouche Zeggagh
  • 3,428
  • 1
  • 25
  • 22
0

You may well have reached the 56k method limit. This can often happen when using Google Play Services which is huge and contains a lot of methods you probably don't need.

Instead of having the line compile 'com.google.android.gms:play-services:7.0.0' in your Gradle file try only using the individual modules you need from the Play Services library.

e.g. compile 'com.google.android.gms:play-services-location:7.0.0' to just use the location services.

A complete list is here

Ivan Wooll
  • 4,145
  • 3
  • 23
  • 34