Android Studio unable to run the project

1.3k views Asked by At

I am trying to build and run the a project which uses a library. It builds properly but when I try to run it, it throws me this error :-

:testapp:preDexDebug                 
warning: Ignoring InnerClasses attribute for an anonymous inner class
        at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.executeAction(ExecuteActionsTaskExecuter.java:80)
        at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.executeActions(ExecuteActionsTaskExecuter.java:61)
        ... 57 more
Caused by: com.android.ide.common.process.ProcessException: org.gradle.process.internal.ExecException: Process 'command 'C:\Program Files\Java\jdk1.7.0_09\bin\java.exe'' finished with
 non-zero exit value 1
        at com.android.build.gradle.internal.process.GradleProcessResult.assertNormalExitValue(GradleProcessResult.java:42)
        at com.android.builder.core.AndroidBuilder.preDexLibrary(AndroidBuilder.java:1296)
        at com.android.builder.internal.compiler.PreDexCache.preDexLibrary(PreDexCache.java:122)
        at com.android.builder.core.AndroidBuilder.preDexLibrary(AndroidBuilder.java:1248)
        at com.android.builder.core.AndroidBuilder$preDexLibrary$10.call(Unknown Source)
        at com.android.build.gradle.tasks.PreDex$PreDexTask.call(PreDex.groovy:150)
        at com.android.build.gradle.tasks.PreDex$PreDexTask.call(PreDex.groovy)
        at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:334)
        at java.util.concurrent.FutureTask.run(FutureTask.java:166)
        at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:471)
        at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:334)
        at java.util.concurrent.FutureTask.run(FutureTask.java:166)
        ... 3 more
Caused by: org.gradle.process.internal.ExecException: Process 'command 'C:\Program Files\Java\jdk1.7.0_09\bin\java.exe'' finished with non-zero exit value 1
        at org.gradle.process.internal.DefaultExecHandle$ExecResultImpl.assertNormalExitValue(DefaultExecHandle.java:365)
        at com.android.build.gradle.internal.process.GradleProcessResult.assertNormalExitValue(GradleProcessResult.java:40)
        ... 14 more

This is the build.gradle of my complete project :-

// Top-level build file where you can add configuration options common to all sub-projects/modules.

buildscript {
    repositories {
        jcenter{
            url "http://jcenter.bintray.com"
        }
    }
    dependencies {
        classpath 'com.android.tools.build:gradle:1.2.3'

        // NOTE: Do not place your application dependencies here; they belong
        // in the individual module build.gradle files
    }
}

allprojects {
    repositories {
        mavenLocal()
        maven{
            url "D:/mavenrepository-new"
        }
        maven{
            url "http://bridge.mindtree.com/nexus/content/repositories/igg-releases/"
        }
        jcenter{
            url "http://jcenter.bintray.com"
        }
    }
}

This is the build.gradle of my Library :-

apply plugin: 'com.android.library'

android {
    compileSdkVersion 22
    buildToolsVersion "22.0.1"

    defaultConfig {
        minSdkVersion 15
        targetSdkVersion 22
        versionCode 1
        versionName "1.0"
    }
    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
    }
    dexOptions {
        preDexLibraries = false
    }
    defaultConfig {
        multiDexEnabled true
    }
    lintOptions {
        abortOnError true
    }
    packagingOptions {
        exclude 'META-INF/NOTICE'
        exclude 'META-INF/notice.txt'
        exclude 'META-INF/license.txt'
        exclude 'META-INF/LICENSE'
        exclude 'META-INF/DEPENDENCIES'
    }
}

dependencies {
    compile fileTree(dir: 'libs', include: ['*.jar'])
    compile 'com.google.android.gms:play-services:7.5.0'
    compile 'com.mindtree.bridge.framework:CoreAPI:1.0.0'
    compile 'com.mindtree.bridge.framework:bridge-account-lib:2.0.0'
    compile 'com.mindtree.bridge.platform:BRBASE-generated-java-api:2.0.0'
}

This is the build.gradle of my app :-

apply plugin: 'com.android.application'

android {
    compileSdkVersion 22
    buildToolsVersion "22.0.1"

    defaultConfig {
        applicationId "com.igotgarbage.testapp"
        minSdkVersion 15
        targetSdkVersion 22
        versionCode 1
        versionName "1.0"
    }
    packagingOptions {
        exclude 'META-INF/NOTICE'
        exclude 'META-INF/notice.txt'
        exclude 'META-INF/license.txt'
        exclude 'META-INF/LICENSE'
        exclude 'META-INF/DEPENDENCIES'
    }
}

dependencies {
    compile fileTree(dir: 'libs', include: ['*.jar'])
    compile 'com.android.support:appcompat-v7:22.2.0'
    compile project(':app')
}

I have tried clean build on my project and everything which the related answers on SO have suggested. But nothing is helping. Some proper answers would be really appreciated.

2

There are 2 answers

2
Maher Abuthraa On

If its not a memory issue as I mentioned.. try this:

File => Invalidate caches/restart

0
debD On
  packagingOptions {
    exclude 'META-INF/notice.txt'
    exclude 'META-INF/license.txt'
    exclude 'META-INF/spring.schemas'
    exclude 'META-INF/spring.handlers'
    exclude 'META-INF/spring.tooling'
    exclude 'META-INF/NOTICE'
    exclude 'META-INF/LICENSE'
    exclude 'META-INF/LICENSE.txt'
    exclude 'META-INF/NOTICE.txt'
    exclude 'META-INF/DEPENDENCIES'
    exclude 'META-INF/DEPENDENCIES.txt'
    exclude 'META-INF/dependencies.txt'
}

lintOptions {
    abortOnError false
}

This exclusion might help and if lint creates some problem you can use the above "lintOptions" code. One more thing you need to take care is, try to close all external applications so that you have free RAM to run and application.This error comes when your CPU usage reaches 100%.