有 Java 编程相关的问题?

你可以在下面搜索框中键入要查询的问题!

java Gradle生成失败ProcessException

我已经试了好几天来让这个构建正确完成。。。它不断失败,出现以下错误:

Error:Execution failed for task ':app:transformClassesWithDexForDebug'.
> com.安卓.build.api.transform.TransformException: com.安卓.ide.common.process.ProcessException: 
org.gradle.process.internal.ExecException: 
Process 'command 'C:\Program Files\Java\jdk1.8.0_31\bin\java.exe'' finished with non-zero exit value 2

我认为失败的gradle文件如下:

dependencies {
  compile fileTree(dir: 'libs', include: ['*.jar'])
  compile project(':vitamio')
  compile project(':zeropush-sdk')
  debugCompile 'com.squareup.leakcanary:leakcanary-安卓:1.3'
  releaseCompile 'com.squareup.leakcanary:leakcanary-安卓-no-op:1.3'
  compile files('libs/YouTubeAndroidPlayerApi.jar')
  compile 'com.安卓.support:appcompat-v7:22.2.1'
  compile 'com.安卓.support:design:22.2.1'
  compile 'com.安卓.support:support-v4:22.2.1'
  compile 'com.google.安卓.gms:play-services-analytics:7.5.0'
  compile 'com.squareup.retrofit:retrofit:1.7.0'
  compile 'com.squareup:otto:1.3.6'
  compile 'com.squareup.picasso:picasso:2.4.0'
  compile 'com.ns-developer:tagcloudview:0.1.0'
  compile 'com.安卓.support:recyclerview-v7:22.2.1'
  compile 'com.安卓.support:mediarouter-v7:22.1.1'
  //    compile 'com.google.安卓.exoplayer:exoplayer:r1.4.1'
  compile('com.crashlytics.sdk.安卓:crashlytics:2.5.3@aar') {
      transitive = true;
  }
  安卓TestCompile 'com.jayway.安卓.robotium:robotium-solo:5.4.1'
}

我认为这与两次添加依赖项有关。。。但我看不到任何两次添加的内容

有没有人看到我不应该导入的内容,或者知道这个错误可能意味着什么

zeropush sdk也构建在该项目中,其gradle文件如下:

dependencies {
   compile fileTree(dir: 'libs', include: ['*.jar'])
   compile 'com.loopj.安卓:安卓-async-http:1.4.6'
   compile 'com.google.安卓.gms:play-services:7.5.0'
}

共 (1) 个答案

  1. # 1 楼答案

    我想做的第一件事是只使用您实际需要的Google Play服务的api,而不是'com。谷歌。安卓游戏服务:7.5.0',见Google Play Services setup。建议您只添加您正在使用的Google Play服务,而不是所有这些服务。这将极大地减少应用程序的大小,并提高对索引的需求

    至于实际的副本,你有

    编译'com。谷歌。安卓游戏服务:7.5.0' 编译'com。谷歌。安卓游戏服务分析:7.5.0'

    拆下以下部件以进行快速测试

    compile 'com.google.android.gms:play-services:7.5.0'
    

    然后添加您需要的任何其他特定Google Play服务api

    也有可能从您的libs文件夹中复制其他副本,但我不能说,因为它没有列出