1

The process gets stuck if I am trying to run the app (even when I start from a fresh new project) both on an emulator (Android 5.0 or 6.0) or on my phone (Android 7.1). Following some results I found online, I tried to run gradle offline but it did not work. I did also try the solutions suggested on this link, with no success. On Ubuntu, this seems to be caused because of a library issue concerning 32-bit software running from a 64-bit system, which can be solved installing the appropriate library, but I could not find any guidance when running Android Studio on Windows.

The build.gradle file (Module: app) says:

apply plugin: 'com.android.application'

android {
    compileSdkVersion 26
    defaultConfig {
        applicationId "com.example.denny.zuzuplayer"
        minSdkVersion 21
        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:appcompat-v7:26.1.0'
    implementation 'com.android.support.constraint:constraint-layout:1.0.2'
    testImplementation 'junit:junit:4.12'
    androidTestImplementation 'com.android.support.test:runner:1.0.1'
    androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.1'
}

The build.gradle (Project) says:

buildscript {

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


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

Thanks!

Denny Ceccon
  • 135
  • 8

2 Answers2

1

It seems I found the solution myself, quite out of serendipity if I shall be honest.

I was staring at my screen, eyes almost bleeding for it's been eighty six years uninterruptedly now, when I noticed Android Studio has a damn tab called Gradle Console, which lists every gradle process that is currently running, in bloody details. That is how I got the message that the "aapt" instance was not fine the old rascal, due probably to the antivirus software. This is what the bastard console told me:

> Exception in thread "queued-resource-processor_16"
> java.lang.RuntimeException: Timed out while waiting for slave aapt
> process, make sure the aapt execute at
> C:\Users\Denny\AppData\Local\Android\Sdk\build-tools\26.0.2\aapt2.exe
> can run successfully (some anti-virus may block it) or try setting
> environment variable SLAVE_AAPT_TIMEOUT to a value bigger than 5
> seconds

Well well, I have no idea how the hell to "set environment variable SLAVE_AAPT_TIMEOUT to a value bigger than 5 seconds". I googled the issue for a few minutes when I wondered, why the fuck not try the other possible solution first? I grabbed my succumbing willpower by the neck and added the SDK folder to my antivirus exceptions (aapt is an instance of SDK, for that matter), and voilà, the project is finally building. Hurray!

I am sharing my discovery for other unfortunate lost souls out there who might face the same issue.

Shalom!

Denny Ceccon
  • 135
  • 8
  • I'm glad you found the solution! Just an FYI, here's how to set the enviroment variable on Windows: http://www.dowdandassociates.com/blog/content/howto-set-an-environment-variable-in-windows-command-line-and-registry/ (just use the name SLAVE_AAPT_TIMEOUT) – Izabela Orlowska Mar 19 '18 at 12:05
0

I just got this error and was able to resolve it by ensuring that the two Glide libraries I'm using refer to the same version.

This caused the error:

implementation 'com.github.bumptech.glide:glide:4.10.0'
annotationProcessor 'com.github.bumptech.glide:compiler:4.0.0'

And this fixed it:

implementation 'com.github.bumptech.glide:glide:4.10.0'
annotationProcessor 'com.github.bumptech.glide:compiler:4.10.0'

I was able to determine that the error was related to the Glide libraries, at least my configuration of them in the module's build.gradle file, by using Denny's suggestion to examine the Gradle tasks. Opening the Gradle Tool Window shows a list of tasks. The Event Log indicated that the error was related to the "assembleDebug" task. So, I double-clicked on that task in the Gradle Tool Window to execute it, and some useful information appeared in a tab on the Run console.

Scott
  • 83
  • 1
  • 8