0

Getting this error after I added compile 'com.google.android.gms:play-services-location:9.0.2'. Error:Execution failed for task ':dexDebug'.

com.android.ide.common.process.ProcessException: org.gradle.process.internal.ExecException: Process 'command 'C:\Program Files\Java\jdk1.8.0_60\bin\java.exe'' finished with non-zero exit value 2.

`

apply plugin: 'com.android.application'

    buildscript {
        repositories {
            jcenter()
        }
        dependencies {
            classpath 'com.android.tools.build:gradle:1.3.0'
            classpath 'com.github.dcendents:android-maven-gradle-plugin:1.3'
            classpath 'com.jfrog.bintray.gradle:gradle-bintray-plugin:1.2'
        }
    }


    dependencies {
        compile fileTree(include: '*.jar', dir: 'libs')
        compile project(':android-support-v7-appcompat')
        compile project(':android-support-v7-CardView')
        compile project(':Material_ContextMenu_Library')
        compile project(':Material_FloatButton_LibraryPrem')
        compile project(':ViewPager_AutoSlider_Library')
        compile project(':google-play-services_lib')
        compile project(':Material_Dialog_Library')
        compile project(':FacebookSDK_Shopsy')
        compile 'com.google.android.gms:play-services-location:9.0.2'
    }




    android {
        compileSdkVersion 21
        buildToolsVersion "21.1.2"
        enforceUniquePackageName = false
        defaultConfig {
            applicationId "in.directcreate"
            minSdkVersion 14
            targetSdkVersion 22
        }



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

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

Full message:

Information:Gradle tasks [:assembleDebug]
WARNING [Project: :] Support for libraries with same package name is deprecated and will be removed in a future release.
:preBuild UP-TO-DATE
:preDebugBuild UP-TO-DATE
:checkDebugManifest
:preReleaseBuild UP-TO-DATE
:Material_ContextMenu_Library:compileLint
:Material_ContextMenu_Library:copyReleaseLint UP-TO-DATE
:Material_ContextMenu_Library:mergeReleaseProguardFiles UP-TO-DATE
:Material_ContextMenu_Library:preBuild UP-TO-DATE
:Material_ContextMenu_Library:preReleaseBuild UP-TO-DATE
:Material_ContextMenu_Library:checkReleaseManifest
:Material_ContextMenu_Library:preDebugAndroidTestBuild UP-TO-DATE
:Material_ContextMenu_Library:preDebugBuild UP-TO-DATE
:Material_ContextMenu_Library:preDebugUnitTestBuild UP-TO-DATE
:Material_ContextMenu_Library:preReleaseUnitTestBuild UP-TO-DATE
:Material_Dialog_Library:compileLint
:google-play-services_lib:compileLint
:google-play-services_lib:copyReleaseLint UP-TO-DATE
:google-play-services_lib:mergeReleaseProguardFiles UP-TO-DATE
:google-play-services_lib:preBuild UP-TO-DATE
:google-play-services_lib:preReleaseBuild UP-TO-DATE
:google-play-services_lib:checkReleaseManifest
:google-play-services_lib:prepareReleaseDependencies
:google-play-services_lib:compileReleaseAidl UP-TO-DATE
:google-play-services_lib:compileReleaseRenderscript UP-TO-DATE
:google-play-services_lib:generateReleaseBuildConfig UP-TO-DATE
:google-play-services_lib:generateReleaseAssets UP-TO-DATE
:google-play-services_lib:mergeReleaseAssets UP-TO-DATE
:google-play-services_lib:generateReleaseResValues UP-TO-DATE
:google-play-services_lib:generateReleaseResources UP-TO-DATE
:google-play-services_lib:packageReleaseResources UP-TO-DATE
:google-play-services_lib:processReleaseManifest UP-TO-DATE
:google-play-services_lib:processReleaseResources UP-TO-DATE
:google-play-services_lib:generateReleaseSources UP-TO-DATE
:google-play-services_lib:processReleaseJavaRes UP-TO-DATE
:google-play-services_lib:compileReleaseJavaWithJavac
:google-play-services_lib:packageReleaseJar UP-TO-DATE
:google-play-services_lib:compileReleaseNdk UP-TO-DATE
:google-play-services_lib:packageReleaseJniLibs UP-TO-DATE
:google-play-services_lib:packageReleaseLocalJar UP-TO-DATE
:google-play-services_lib:packageReleaseRenderscript UP-TO-DATE
:google-play-services_lib:bundleRelease UP-TO-DATE
:compileDebugAidl UP-TO-DATE
:compileDebugRenderscript UP-TO-DATE
:generateDebugBuildConfig UP-TO-DATE
:generateDebugAssets UP-TO-DATE
:mergeDebugAssets UP-TO-DATE
:generateDebugResValues UP-TO-DATE
:generateDebugResources UP-TO-DATE
:mergeDebugResources UP-TO-DATE
:processDebugManifest UP-TO-DATE
:processDebugResources UP-TO-DATE
:generateDebugSources UP-TO-DATE
:processDebugJavaRes UP-TO-DATE
:compileDebugJavaWithJavac UP-TO-DATE
:compileDebugNdk UP-TO-DATE
:compileDebugSources UP-TO-DATE
:preDexDebug UP-TO-DATE
:dexDebug
UNEXPECTED TOP-LEVEL EXCEPTION:
com.android.dex.DexException: Multiple dex files define Landroid/support/annotation/AnimRes;
    at com.android.dx.merge.DexMerger.readSortableTypes(DexMerger.java:596)
    at com.android.dx.merge.DexMerger.getSortedTypes(DexMerger.java:554)
    at com.android.dx.merge.DexMerger.mergeClassDefs(DexMerger.java:535)
    at com.android.dx.merge.DexMerger.mergeDexes(DexMerger.java:171)
    at com.android.dx.merge.DexMerger.merge(DexMerger.java:189)
    at com.android.dx.command.dexer.Main.mergeLibraryDexBuffers(Main.java:454)
    at com.android.dx.command.dexer.Main.runMonoDex(Main.java:303)
    at com.android.dx.command.dexer.Main.run(Main.java:246)
    at com.android.dx.command.dexer.Main.main(Main.java:215)
    at com.android.dx.command.Main.main(Main.java:106)
Error:Execution failed for task ':dexDebug'.
> com.android.ide.common.process.ProcessException: org.gradle.process.internal.ExecException: Process 'command 'C:\Program Files\Java\jdk1.8.0_60\bin\java.exe'' finished with non-zero exit value 2
Information:BUILD FAILED
Information:Total time: 40.842 secs
Information:1 error
Information:0 warnings
Information:See complete output in console
OneCricketeer
  • 179,855
  • 19
  • 132
  • 245
  • Most probably you're out of memory. Can you run gradle with `--debug` flag? – Eugen Martynov Jun 07 '16 at 12:35
  • You need to post more details. Just before `com.android.ide.common.process.ProcessException: ` it would have printed the actual reason. Post that here. – Udayaditya Barua Jun 07 '16 at 12:39
  • You already compiled the entire Google play services lib **project**, so you don't need that line... Please see this for more information http://stackoverflow.com/questions/36698816/gradle-what-is-a-non-zero-exit-value-and-how-do-i-fix-it – OneCricketeer Jun 07 '16 at 12:43
  • @cricket_007 If I remove compile 'com.google.android.gms:play-services-location:9.0.2' then I cant create instance for Google Places. – Tarun Bansal Jun 08 '16 at 05:20
  • Really? Does `compile project(':google-play-services_lib')` not include Places? If not then remove that line and see https://developers.google.com/android/guides/setup#add_google_play_services_to_your_project – OneCricketeer Jun 08 '16 at 05:22
  • So, you have included the Android support annotations several times, thus the error. Options 1) Figure out how to clean up your dependencies or 2) Enable multidex – OneCricketeer Jun 08 '16 at 05:36
  • @cricket_007 enabling mutidex didnt help – Tarun Bansal Jun 08 '16 at 05:41
  • Your error does not state you are using Multidex, so maybe you are getting a different error with it – OneCricketeer Jun 08 '16 at 05:43

0 Answers0