简体   繁体   中英

Java\jdk1.7.0_06\bin\java.exe'' finished with non-zero exit value 1 android studio

I am getting this error while i run program in the Android studio.. There is no anyother is here i guess.

Error:Execution failed for task ':app:createDebugMainDexClassList'.

com.android.ide.common.process.ProcessException: org.gradle.process.internal.ExecException: Process 'command 'C:\\Program Files (x86)\\Java\\jdk1.7.0_06\\bin\\java.exe'' finished with non-zero exit value 1

Here it is my gradle file copy..

    apply plugin: 'com.android.application'
android {
    compileSdkVersion 25
    buildToolsVersion "25.0.1"
    useLibrary 'org.apache.http.legacy'

    defaultConfig {
        applicationId "app.example.com"
        minSdkVersion 14
        targetSdkVersion 25
        versionCode 1
        versionName "1.0"
        multiDexEnabled true
    }
    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
    }

    compileOptions {
        sourceCompatibility JavaVersion.VERSION_1_7
        targetCompatibility JavaVersion.VERSION_1_7
    }
    lintOptions { abortOnError false }
}

dependencies {
    compile fileTree(dir: 'libs', include: ['*.jar'])
    compile files('libs/socialauth-4.9.jar')
    compile 'com.android.support:recyclerview-v7:+'
    compile project(':linkedin-sdk')
    compile 'com.squareup.picasso:picasso:2.5.2'
    compile 'org.lucasr.twowayview:twowayview:0.1.4'
    compile 'de.hdodenhof:circleimageview:1.2.1'
    compile 'com.android.support:appcompat-v7:+'
    compile 'com.android.support:design:+'
    compile 'com.google.android.gms:play-services:7.3.0'
    compile 'com.android.support:multidex:1.0.1'
    compile 'com.nostra13.universalimageloader:universal-image-loader:1.9.5'
    compile ('org.apache.httpcomponents:httpmime:4.3.5')
            {
              exclude group: 'org.apache.httpcomponents', module: 'httpclient'
            }
}

what's the issue ?

its seems to be multidex issue. just add maximum heap size and multidex library dependency.

android {

dexOptions {
    incremental = true;
    preDexLibraries = false
    javaMaxHeapSize "4g" 
}

}

defaultConfig {

    multiDexEnabled true
}

also put Dependency

compile 'com.android.support:multidex:1.0.0'

you will also need to extend your application class to MultiDexApplication

public class App extends MultiDexApplication {

@Override
public void onCreate()
{
    super.onCreate();
    // Initialize 
}

@Override
protected void attachBaseContext(Context base)
{
    super.attachBaseContext(base);
    MultiDex.install(this);
}

}

Don't forgot to make an entry of app class in manifest.

Use this in app build.gradle worked for me

defaultConfig {
// Enabling multidex support.
multiDexEnabled true
}

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM