1
votes

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

enter image description here

1
But in latest version of android studio there is no folder named librariesAyusch
Nothing worked please help!!Ayusch
There is a problem with your project, that is why you get this error. Other then trying various gradle build jobs ("build", "assemble") to get a better a error message its very difficult to help. (It could be the 65K method limit, another problem there is a lot of stuff which could go wrong)morpheus05
You problem has absolutely nothing to do with Gradle. Read the error message. You need to use Theme.AppCompat (or descendant) with the design library. That has been answered very heavily here.OneCricketeer

1 Answers

-1
votes

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.