Build Gradle Eterno

Asked

Viewed 496 times

1

I couldn’t find anything like it. When I try to run a book project it gets like this:

"Gradle: Resolve dependencies: 'app:_debugCompile'"

And do not compile for anything. I changed my Gradle file to the versions I have.

apply plugin: 'com.android.application'

android {
compileSdkVersion 23
buildToolsVersion "23.0.2"

defaultConfig {
    applicationId "br.com.exemplo.material"
    minSdkVersion 9
    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'])
    compile 'com.android.support:appcompat-v7:23.1.1'
    compile 'com.android.support:cardview-v7:23.1.1'
    compile 'com.android.support:recyclerview-v7:23.1.1'
    compile 'com.android.support:palette-v7:23.1.1'
    compile 'com.android.support:design:23.1.1'
}

And yet it is "compiling" straight and no error, It is half stuck. I don’t know what to do.

Follow below the image. Erro

2 answers

1

mine was so in my case, it was an error in xml file where I had a cardview went to File menu, Settings Build,Execution,Deployment> Build Tools> Gradle and enabled the option Offline work, gave a Clean Project and then Rebuild Project and he soon accused the error.

  • Thank you for your reply. I will try to do so.

0

It was with the same problem, so I decided to help, to increase the speed of Build Gradle, modify your settings and scripts as follows:

1 - Click File > Settings > Gradle > and Modify as below:

inserir a descrição da imagem aqui

  • Select the Offline work option and click OK

2 - Click File > Settings > Compiler > and Modify as below:

inserir a descrição da imagem aqui

  • Select the above four options "Compile, Make, Sync, Configure" and put in Command-line Options: --offline and click OK

3 - modify the following script build.Gradle(Module:app) - add dexOptions:

apply plugin: 'com.android.application'

    android {
       ...
        }

        dexOptions {
            javaMaxHeapSize "4g" //specify the heap size for the dex process
        }

        buildTypes {
            release {
                minifyEnabled false
                proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
            }
        }
    }

    dependencies {
        compile fileTree(dir: 'libs', include: ['*.jar'])
        compile 'com.android.support:appcompat-v7:25.3.1'
        compile 'com.android.support:design:25.3.1'
        compile 'com.android.support:support-v4:25.3.1'
        compile 'com.android.support.constraint:constraint-layout:1.0.2'
    }

Add this snippet:

    dexOptions {
                    javaMaxHeapSize "4g" //specify the heap size for the dex process
}

4 - modify the following script Gradle.properties(Project Properties):

# Project-wide Gradle settings.

# IDE (e.g. Android Studio) users:
# Gradle settings configured through the IDE *will override*
# any settings specified in this file.

# For more details on how to configure your build environment visit
# http://www.gradle.org/docs/current/userguide/build_environment.html

# Specifies the JVM arguments used for the daemon process.
# The setting is particularly useful for tweaking memory settings.

org.gradle.jvmargs=-Xmx2048m -XX:MaxPermSize=512m -XX:+HeapDumpOnOutOfMemoryError -Dfile.encoding=UTF-8
org.gradle.daemon=true
org.gradle.parallel=true


# When configured, Gradle will run in incubating parallel mode.
# This option should only be used with decoupled projects. More details, visit
# http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects
# org.gradle.parallel=true

Add this snippet:

org.gradle.jvmargs=-Xmx2048m -XX:MaxPermSize=512m -XX:+HeapDumpOnOutOfMemoryError -Dfile.encoding=UTF-8
org.gradle.daemon=true
org.gradle.parallel=true

If a warning appears upstairs, click on Try Again... or Sync Now, and see the result.


Tip: In case your Android Studio is taking too long to start, recommend also see this post on how to increase IDE memory.


I hope I helped. I worked, the Gradle is faster.

Browser other questions tagged

You are not signed in. Login or sign up in order to post.