Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/android/226.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Java 将iText 5.5.6添加到Android项目,但gradle例外_Java_Android_Itext - Fatal编程技术网

Java 将iText 5.5.6添加到Android项目,但gradle例外

Java 将iText 5.5.6添加到Android项目,但gradle例外,java,android,itext,Java,Android,Itext,我正在尝试使用Android Studio(gradle)将iTextPDF库添加到Android项目中。我使用compile'com.itextpdf:itextpdf:5.5.6'指令添加了库,但出现错误: 错误:任务“:app:dexDebug”的执行失败。 com.android.ide.common.process.ProcessException:org.gradle.process.internal.ExecException:process'command'/opt/jdk1.7

我正在尝试使用Android Studio(gradle)将iTextPDF库添加到Android项目中。我使用compile'com.itextpdf:itextpdf:5.5.6'指令添加了库,但出现错误:

错误:任务“:app:dexDebug”的执行失败。 com.android.ide.common.process.ProcessException:org.gradle.process.internal.ExecException:process'command'/opt/jdk1.7.0_79/bin/java''以非零退出值2结束

我的build.gradle是:

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'
}

你很可能已经达到了56k方法的极限。这经常发生在使用Google Play服务时,Google Play服务非常庞大,包含了很多您可能不需要的方法

不要在Gradle文件中使用
编译'com.google.android.gms:play services:7.0.0'
,而只使用play services库中需要的单个模块

e、 g.
编译'com.google.android.gms:play services location:7.0.0'
以仅使用定位服务


完整的列表是

我有这个问题,试试5.5.10它对我有用

compile 'com.itextpdf:itextg:5.5.10'

我将这两个依赖项放在渐变中:

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

使用这些依赖项:

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'

我之前也遇到过同样的问题,请看一下这个链接,它给我带来了布鲁诺·洛瓦吉的评论,这就是解决方案。非常感谢@bpA