【问题标题】:Android app:transformClassesWithDexForDebugAndroid 应用程序:transformClassesWithDexForDebug
【发布时间】:2016-03-22 15:34:11
【问题描述】:

在多次尝试使用其他网络解决方案后,我感到绝望。

如果有人能帮我解决这个问题,我会更高兴的!:

错误:任务 ':app:transformClassesWithDexForDebug' 执行失败。

com.android.build.api.transform.TransformException: com.android.ide.common.process.ProcessException: org.gradle.process.internal.ExecException: Process 'command 'C:\Program Files\Java\jdk1 .8.0_65\bin\java.exe'' 以非零退出值 3 结束

我的项目运行完美,直到我尝试向我的项目添加新的依赖项 org.apache.pdfbox:pdfbox:1.5.0, com.github.PhilJay:MPAndroidChart:v2.2.3 或 'com.google.guava:guava:16.0.1' - 但没有成功 - 总是遇到同样的错误。

我还尝试以不同的方式添加每一个:当然是作为模块、Jar 或 Gradle 依赖项 - 总是得到相同的错误。

我的 Gradle 版本:'com.android.tools.build:gradle:1.5.0'

Android Studio:1.5.1

SDK:23

这是我的 build.gradle

apply plugin: 'com.android.application'

机器人{ compileSdkVersion 23 构建工具版本“23.0.2” 数据绑定 { 启用 = 真 }

defaultConfig {
    applicationId "com.alfred.alfredapplication"
    minSdkVersion 14
    targetSdkVersion 23
    versionCode 1
    versionName "1.0"
    multiDexEnabled true
}
buildTypes {
    release {
        minifyEnabled false
        proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
    }
}
dexOptions {
    incremental true
}

}

依赖{ 编译文件树(包括:['*.jar'],目录:'libs') testCompile 'junit:junit:4.12'

compile 'com.android.support:cardview-v7:23.2.0'
compile 'com.android.support:recyclerview-v7:23.2.0'
compile 'com.android.support:design:23.2.0'
compile 'org.jsoup:jsoup:1.8.3'
compile 'com.android.support:appcompat-v7:23.0.1'
compile 'com.google.android.gms:play-services-identity:7.8.0'
compile('com.google.api-client:google-api-client-android:1.20.0') {
    exclude group: 'org.apache.httpcomponents'
}

compile('com.google.apis:google-api-services-gmail:v1-rev40-1.21.0') {
    exclude group: 'org.apache.httpcomponents'
}

/*compile files('libs/pdfbox-2.0.0.jar')*/

compile 'com.android.support:multidex:1.0.1'

我的 AndroidManifest.xml 包括:

    android:name="android.support.multidex.MultiDexApplication

那么问题可能是什么?非常感谢!

【问题讨论】:

  • 不要使用多索引。发布您的整个 build.gradle。
  • 我尝试使用 multidex 只是因为其他人在网络上发布了它有一个解决方案,即使我禁用了 multidex 我也会遇到同样的错误。
  • 我用整个 bulid.gradle 更新帖子
  • 1.尝试删除数据绑定 2. 尝试删除multiDexEnabled true 3. 尝试删除compile 'com.android.support:multidex:1.0.1' 4. 应用程序兼容版本应与设计相同:23.2.1 是最新的。一个一个去掉后,慢慢加回来。
  • 我遵循了这些步骤,但不幸的是得到了同样的错误......

标签: java android android-studio gradle google-play-services


【解决方案1】:

在 gradle 文件中的 android { } 下添加这些行。

    packagingOptions {
        exclude 'META-INF/DEPENDENCIES'
        exclude 'META-INF/NOTICE'
        exclude 'META-INF/LICENSE'
        exclude 'META-INF/LICENSE.txt'
        exclude 'META-INF/NOTICE.txt'
        exclude 'LICENSE.txt'
    }

【讨论】:

  • 问题解决了!一个旧的 mpandroidchart 罐子在我的“libs”文件夹中
  • @RoiZlot 请删除您的问题或自己回答,以免造成孤儿,并可能帮助其他人。
猜你喜欢
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2016-11-06
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多