sherin
sherin

Reputation: 1091

Android studio: Gradle build finished with error

I have been using Android Studio and I am getting this error when trying to build.I can't able to proceed.

This is the error in Android Studio:

    Executing tasks: [:libraries:facebook:generateDebugSources, :library:generateDebugSources, :volley:generateDebugSources]

    Configuration on demand is an incubating feature.
    WARNING [Project: :volley] "testPackageName" is deprecated (and will soon stop working); change to "testApplicationId" instead
    :libraries:facebook:preBuild
    :libraries:facebook:preDebugBuild
    :libraries:facebook:checkDebugManifest
    :libraries:facebook:prepareDebugDependencies
    :libraries:facebook:compileDebugAidl UP-TO-DATE
    :libraries:facebook:compileDebugRenderscript UP-TO-DATE
    :libraries:facebook:generateDebugBuildConfig UP-TO-DATE
    :libraries:facebook:generateDebugAssets UP-TO-DATE
    :libraries:facebook:mergeDebugAssets UP-TO-DATE
    :libraries:facebook:generateDebugResValues UP-TO-DATE
    :libraries:facebook:generateDebugResources UP-TO-DATE
    :libraries:facebook:packageDebugResources UP-TO-DATE
    :libraries:facebook:processDebugManifest UP-TO-DATE
    :libraries:facebook:processDebugResources UP-TO-DATE
    :libraries:facebook:generateDebugSources UP-TO-DATE
    :library:preBuild
    :library:preDebugBuild
    :library:checkDebugManifest
    :library:prepareDebugDependencies
    :library:compileDebugAidl UP-TO-DATE
    :library:compileDebugRenderscript UP-TO-DATE
    :library:generateDebugBuildConfig UP-TO-DATE
    :library:generateDebugAssets UP-TO-DATE
    :library:mergeDebugAssets UP-TO-DATE
    :library:generateDebugResValues UP-TO-DATE
    :library:generateDebugResources UP-TO-DATE
    :library:packageDebugResources UP-TO-DATE
    :library:processDebugManifest UP-TO-DATE
    :library:processDebugResources UP-TO-DATE
    :library:generateDebugSources UP-TO-DATE
    :volley:preBuild
    :volley:preDebugBuild
    :volley:checkDebugManifest
    :volley:prepareDebugDependencies
    :volley:compileDebugAidl UP-TO-DATE
    :volley:compileDebugRenderscript UP-TO-DATE
    :volley:generateDebugBuildConfig UP-TO-DATE
    :volley:generateDebugAssets UP-TO-DATE
    :volley:mergeDebugAssets UP-TO-DATE
    :volley:generateDebugResValues UP-TO-DATE
    :volley:generateDebugResources UP-TO-DATE
    :volley:packageDebugResources UP-TO-DATE
    :volley:processDebugManifest UP-TO-DATE
    :volley:processDebugResources UP-TO-DATE
    :volley:generateDebugSources UP-TO-DATE

BUILD FAILED

Total time: 2 mins 7.494 secs

This is my app gradle :

build.gradle :

        apply plugin: 'android'

    android {
        compileSdkVersion 19
        buildToolsVersion '19.1.0'
        defaultConfig {
            minSdkVersion 11
            targetSdkVersion 19
            versionCode 1
            versionName '1.0'
        }
        signingConfigs {
            release {

            }
        }
        buildTypes {
            release {
                signingConfig signingConfigs.release
            }
        }
        packagingOptions {
            exclude 'META-INF/DEPENDENCIES'
            exclude 'META-INF/NOTICE'
            exclude 'META-INF/LICENSE'
            exclude 'META-INF/LICENSE.txt'
            exclude 'META-INF/NOTICE.txt'
            exclude 'META-INF/ASL2.0'
        }
        productFlavors {
        }
    }


    dependencies {
        compile 'com.android.support:support-v4:19.1.0'
        compile 'com.google.android.gms:play-services:5.0.77'
        compile 'com.android.support:appcompat-v7:+'
        compile 'com.makeramen:roundedimageview:1.2.4'
        compile 'com.nineoldandroids:library:2.4.0+'
        compile project(':libraries:facebook')
        compile project(':library')
        compile project(':stripe')
        compile project(':volley')
        compile fileTree(dir: 'libs', include: ['*.jar'])
        compile files('libs/activation.jar')
        compile files('libs/mail.jar')
        compile files('libs/iprint.jar')
    }

Upvotes: 5

Views: 42685

Answers (4)

user5574803
user5574803

Reputation: 31

This Question is old but it may be useful for new programmers of Android Studio , So this error in my case solved by cleaning project from Build Menu.

Upvotes: 3

Apurv Agarwal
Apurv Agarwal

Reputation: 3188

I faced this problem in ubuntu 16.04 and came up with a simple solution:

Type sudo nautilus in terminal.

Now go to the root directory and recursively change permissions to Read and Write and Create and Delete files. You will be able to do that by the option Change permissions for enclosed files.

Upvotes: 0

Volodymyr Yatsykiv
Volodymyr Yatsykiv

Reputation: 3211

I'm not sure if you post all error's text, in my case in the end will be very useful information to fix this trouble. Maybe in your case trouble is the same.

So, in my case was trouble with dependecies. In my app module in build.grale I used other dependencies for support.v4

In your case: compile 'com.android.support:support-v4:19.1.0'

Facebook SDK used jar, so, support.v4 was added as jar.

To fix this, just remove jar, and add to your Facebook build.gradle file the same line to import support library as on your main app module.

Hope, this will help you.

Upvotes: 2

San
San

Reputation: 5697

I faced same issue today

This is a bug in dex merger when the dex files that are being merged have more than 65536 methods (or strings). We can fix this by adding

dexOptions { jumboMode = true }

In the gradle file. Don’t forget to add this all sub projects too else it may not work.

Upvotes: 0

Related Questions