在gradle构建之后运行app时出错

时间:2016-04-14 13:09:25

标签: android gradle android-gradle

过去一周我从未接触过我的gradle代码,直到昨天工作正常,但从今天早上突然发现此错误

  

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

     
    

com.android.build.api.transform.TransformException:com.android.ide.common.process.ProcessException:     org.gradle.process.internal.ExecException:进程'命令     ' C:\ Program Files \ Java \ jdk1.7.0_75 \ bin \ java.exe''完成了     非零退出值3

  
下面的

是我项目的gradle代码片段

apply plugin: 'com.android.application'

//apply plugin: 'io.fabric'
// Top-level build file where you can add configuration options common to all sub-projects/modules.

buildscript {
    repositories {
        jcenter()
        maven { url 'https://maven.fabric.io/public' }
    }
    dependencies {

        classpath 'com.android.tools.build:gradle:1.5.0'
        // NOTE: Do not place your application dependencies here; they belong
        // in the individual module build.gradle files
        //classpath 'io.fabric.tools:gradle:1.+'
    }
}

allprojects {
    repositories {
        jcenter()
    }
}
dependencies {
    compile fileTree(dir: 'libs', include: '*.jar')
    compile 'com.android.support:appcompat-v7:23.1.1'
    compile 'com.android.support:recyclerview-v7:23.1.1'
    compile 'com.android.support:design:23.1.1'
    compile 'com.android.support:cardview-v7:23.1.1'
    compile 'com.squareup.picasso:picasso:2.5.2'
    compile'com.android.support:multidex:1.0.0'
    compile 'com.android.support:design:23.1.1'
    compile 'com.google.android.gms:play-services-gcm:8.4.0'
    compile 'com.google.android.gms:play-services:8.4.0'
    compile fileTree(dir: 'libs', include: ['*.jar'])
    compile 'com.android.support:appcompat-v7:23.0.1'
    compile 'com.android.support:design:23.0.1'
    compile fileTree(dir: 'libs', include: ['*.jar'])
    compile 'com.android.support:appcompat-v7:21.0.3'
    compile 'com.google.code.gson:gson:2.6.1'
    compile 'me.drakeet.materialdialog:library:1.2.8'
    compile 'de.hdodenhof:circleimageview:2.0.0'
    compile files('libs/FlurryAnalytics-5.6.0.jar')
    compile 'com.nostra13.universalimageloader:universal-image-loader:1.9.5'
    compile 'com.github.paolorotolo:appintro:3.4.0'
    //    compile('com.crashlytics.sdk.android:crashlytics:2.5.5@aar') {
    //        transitive = true;
    //    }

}

repositories {
    mavenCentral()
//    maven { url 'https://maven.fabric.io/public' }
}

dependencies {
    compile 'com.github.paolorotolo:appintro:3.4.0'


}
android {
    compileSdkVersion 23
    buildToolsVersion "22.0.1"


    sourceSets {
        main {
            manifest.srcFile 'AndroidManifest.xml'
            java.srcDirs = ['src']
            resources.srcDirs = ['src']
            aidl.srcDirs = ['src']
            renderscript.srcDirs = ['src']
            res.srcDirs = ['res']
            assets.srcDirs = ['assets']
        }

        // Move the tests to tests/java, tests/res, etc...
        instrumentTest.setRoot('tests')

        // Move the build types to build-types/<type>
        // For instance, build-types/debug/java, build-types/debug/AndroidManifest.xml, ...
        // This moves them out of them default location under src/<type>/... which would
        // conflict with src/ being used by the main source set.
        // Adding new build types or product flavors should be accompanied
        // by a similar customization.
        debug.setRoot('build-types/debug')
        release.setRoot('build-types/release')
    }

    defaultConfig {
        multiDexEnabled true
    }

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




dependencies {
    compile 'com.google.android.gms:play-services-gcm:8.4.0'
}
dependencies {
    compile 'com.google.android.gms:play-services-ads:8.4.0'
}
dependencies {
    compile 'com.google.android.gms:play-services-identity:8.4.0'
}
dependencies {
    compile 'com.google.android.gms:play-services-gcm:8.4.0'
}

请帮我解决错误,谢谢

1 个答案:

答案 0 :(得分:0)

也许这会对你有所帮助。在app build.gradle中提及

android{
dexOptions {
    preDexLibraries = false
    javaMaxHeapSize "2g"
}
}
相关问题