Java.exe error while building project in Android S

2019-09-24 13:27发布

问题:

After creating a new project when I try to run the app it shows build failed error.

I searched for it on the internet, they say that it may be due to duplicate libraries of gradle or duplicate dependencies in gradle file, but it wasn't so In my case.

Here is my build.gradle file :

apply plugin: 'com.android.application'
android {
    compileSdkVersion 23
    buildToolsVersion "23.0.2"
    defaultConfig {
        applicationId "com.example.naveenjain.ayusch"
        minSdkVersion 14
        targetSdkVersion 23
        versionCode 1
        versionName "1.0"
    }
    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }   
 } 
}

dependencies {
    compile fileTree(dir: 'libs', include: ['*.jar'])
    testCompile 'junit:junit:4.12'
    compile 'com.android.support:appcompat-v7:23.1.1'
    compile 'com.android.support:design:23.1.1'
}

回答1:

Try to delete this line:

compile fileTree(dir: 'libs', include: ['*.jar'])

Or you could set multiDexEnabled true:

defaultConfig {        
    // Enabling multidex support.
    multiDexEnabled true
}

and try again. Hope it helps.