Error compiling Android app with gradle from command line

0

I have created a basic Android app from Android Studio, with just two buttons, simple, without modifying any configuration or compilation file.

I'm trying to learn how to use Gradle from the command line, create compilation settings, etc ...

When compiling the app from Android Studio, it compiles perfectly, generates the APK, executes me in emulator ... everything is correct.

When I go to the Android Studio terminal, or from the Windows cmd itself, when I launch gradlew.bat with any of its options like gradlew.bat tasks , I jump always the following error:

  

Starting a Gradle Daemon (subsequent builds will be faster)

     

FAILURE: Build failed with an exception.

     
  • What went wrong: Unable to start the daemon process. This problem might be caused by incorrect configuration of the daemon. For example,   an unrecognized jvm option is used. Please refer to the user guide   chapter on the daemon at    link Please read   the following process output to find out more:

         

    Error occurred during initialization of VM Could not reserve enough space for 1572864KB object heap

  •   
  • Try: Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.

  •   
  • Get more help at link

  •   

I do not understand what the error actually refers to. Does it have to do with the memory of the settings.gradle ?

I leave the gradle files, in case they help:

build.gradle (module)

android {
    compileSdkVersion 26
    defaultConfig {
        applicationId "com.devcodeg.android.geoquiz"
        minSdkVersion 16
        targetSdkVersion 26
        versionCode 1
        versionName "1.0"
        testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
    }
    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
    }
}

dependencies {
    implementation fileTree(dir: 'libs', include: ['*.jar'])
    implementation 'com.android.support.constraint:constraint-layout:1.1.3'
    testImplementation 'junit:junit:4.12'
    androidTestImplementation 'com.android.support.test:runner:1.0.2'
    androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.2'
}

build.gradle (Project)

// Top-level build file where you can add configuration options common to all sub-projects/modules.

buildscript {

    repositories {
        google()
        jcenter()
    }
    dependencies {
        classpath 'com.android.tools.build:gradle:3.1.4'


        // NOTE: Do not place your application dependencies here; they belong
        // in the individual module build.gradle files
    }
}

allprojects {
    repositories {
        google()
        jcenter()
    }
}

task clean(type: Delete) {
    delete rootProject.buildDir
}

settings.gradle

org.gradle.jvmargs=-Xmx1536m
    
asked by DevCodeG 18.09.2018 в 00:43
source

0 answers