2016-03-08 110 views
2

首先,我想承认我知道大多数关于gradle问题的问题。这不是重复的。问题与其他问题类似,但所有解决方案都失败当我添加谷歌播放服务广告库时发生问题。它的应用程序已经正确构建之前。在添加之后经典问题发生。在gradle上构建android应用程序

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 '/usr/lib/jvm/java-7-oracle/bin/java'' finished with non-zero exit value 1 
in some cases exit value was 3 

我曾与几个模块排除改变gradle这个文件很多次,扩大机器人工作室堆大小和许多其他的可能性。毕竟尝试后,我无法弄清楚什么是错的。

摇篮文件:

buildscript { 
    repositories { 
     maven { url 'https://maven.fabric.io/public' } 
    } 

    dependencies { 
     classpath 'io.fabric.tools:gradle:1.+' 
    } 
} 
apply plugin: 'com.android.application' 
apply plugin: 'io.fabric' 
apply plugin: 'com.neenbedankt.android-apt' 
apply plugin: 'com.google.gms.google-services' 


repositories { 
    maven { url 'https://maven.fabric.io/public' } 
    maven { url "https://clojars.org/repo/" } 
    maven { url "https://jitpack.io" } 

} 

android { 
    compileSdkVersion 23 
    buildToolsVersion "23.0.2" 

    defaultConfig { 
     applicationId "xxx" 
     minSdkVersion 16 
     targetSdkVersion 23 
     versionCode 1 
     versionName "1.0" 
     multiDexEnabled true 
    } 

    dexOptions { 
     preDexLibraries = false 
    //I have also tried enlarging heap size here 
    } 

    buildTypes { 
     release { 
      shrinkResources true 
      minifyEnabled false 
      proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' 
     } 
    } 
    packagingOptions { 
     exclude 'META-INF/DEPENDENCIES' 
     exclude 'META-INF/NOTICE' 
     exclude 'META-INF/LICENSE' 
     exclude 'META-INF/LICENSE.txt' 
     exclude 'META-INF/NOTICE.txt' 
    } 
    lintOptions { 
     checkReleaseBuilds false 
    } 
} 

dependencies { 
    compile 'com.android.support:multidex:1.0.0' 
    compile fileTree(dir: 'libs', include: ['*.jar']) 
    apt "com.google.dagger:dagger-compiler:2.0.2" 
    // Needed for @Generated annotation (missing in Java <= 1.6; therefore, Android) 
    compile('com.crashlytics.sdk.android:crashlytics:[email protected]') { 
     transitive = true; 
    } 
    //ads lib ruined building 
    compile 'com.google.android.gms:play-services-ads:8.3.0' 
    compile("com.google.android.gms:play-services-gcm:8.3.0") { 
     exclude module: 'httpclient' //by artifact name 
     exclude group: 'org.apache.httpcomponents' //by group 
     exclude group: 'org.apache.httpcomponents', module: 'httpclient' //by both name and group 
    } 
    compile 'com.facebook.android:facebook-android-sdk:4.0.0' 
    compile 'com.google.guava:guava:19.0' 
    compile 'com.android.support:appcompat-v7:23.1.1' 
    compile 'com.android.support:design:23.1.1' 
    compile 'com.jakewharton:butterknife:7.0.1' 
    compile 'com.squareup.okhttp:okhttp:2.7.4' 
    compile('com.squareup.retrofit2:retrofit:2.0.0-beta4') { 
     exclude module: 'okhttp' 
    } 
    compile 'com.squareup.retrofit2:converter-gson:2.0.0-beta4' 
    compile 'com.squareup.retrofit2:adapter-rxjava:2.0.0-beta4' 
    compile 'com.squareup.okhttp3:logging-interceptor:3.0.1' 
    compile 'com.google.code.gson:gson:2.5' 
    compile 'com.google.dagger:dagger:2.0.2' 
    compile('com.google.apis:google-api-services-youtube:v3-rev162-1.21.0') { 
     exclude group: 'com.google.guava' 
     exclude module: 'httpclient' //by artifact name 
     exclude group: 'org.apache.httpcomponents' //by group 
     exclude group: 'org.apache.httpcomponents', module: 'httpclient' //by both name and group 
    } 
    compile 'com.nostra13.universalimageloader:universal-image-loader:1.9.5' 
    compile 'io.reactivex:rxandroid:1.1.0' 
    compile 'io.reactivex:rxjava:1.1.0' 
    compile 'com.github.orhanobut:logger:1.12' 
    compile 'javax.annotation:jsr250-api:1.0' 
    compile 'frankiesardo:icepick:3.1.0' 
    apt 'frankiesardo:icepick-processor:3.1.0' 
} 

我不希望使用谷歌整体播放服务库。当发生

摇篮控制台输出错误:

:app:transformClassesWithDexForDebug 
Uncaught translation error: java.util.concurrent.ExecutionException: 
java.lang.OutOfMemoryError: GC overhead limit exceeded Uncaught translation error: 
java.util.concurrent.ExecutionException: java.lang.OutOfMemoryError: 
GC overhead limit exceeded 2 errors; aborting FAILED 
+1

“在添加经典问题后” - 通常,真正的问题在Gradle控制台的某个地方描述,而不是您在问题中包含的内容。请编辑您的问题以包含此版本的整个Gradle控制台输出,而不仅仅是这几行。 – CommonsWare

+0

:app:transformClassesWithDexForDebug 未捕获的转换错误:java.util.concurrent.ExecutionException:java.lang.OutOfMemoryError:超出GC开销限制 未捕获的转换错误:java.util.concurrent.ExecutionException:java.lang.OutOfMemoryError:GC开销限制超过 2个错误;堕胎 失败 就是这样。在添加广告库之前,一切正常。 – Nihilus13

+1

http://stackoverflow.com/questions/30045417/android-studio-gradle-could-not-reserve-enough-space-for-object-heap – CommonsWare

回答

0

根据miva2cricket_007意见 - 他们拥有的权利。库太多了。我删除了

compile 'com.squareup.okhttp:okhttp:2.7.4' 

来自gradle构建文件和应用程序已构建。

相关问题