15

When I build my project. Gradle result is underblock (I'm using data binding in some code)

Error:A problem was found with the configuration of task ':app:processDebugAndroidTestResources'.> Directory 'C:\Users\user\Desktop\"My project loaction"\app\build\intermediates\data-binding-layout-out\androidTest\debug' specified for property 'resDir' does not exist.

I' try many method (ex: gradle setting, Android stdio setting reset, disable instant run, make just empty directory). but this method is not work for me. Is any Idea of solution?

My env

Adnroid stuidio : ver 2.2.3

Gradle : ver 3.2 (use local)

Settings (Build, Execution, Deployment)

  • Complier : All 4 check box checked
  • Instant Run : Disable

     buildscript {
        repositories {
            maven { url "https://plugins.gradle.org/m2/" }
        }

        dependencies {
            classpath "gradle.plugin.me.tatarka:gradle-retrolambda:3.4.0"
        }
    }

    apply plugin: 'com.android.application'

    //Can lambda expression in android
    apply plugin: "me.tatarka.retrolambda"


    android {
        compileSdkVersion 23
        buildToolsVersion '23.0.3'

        defaultConfig {
            applicationId "My project package name"
            minSdkVersion 21
            versionCode 1
            versionName "1.0"
        }

        buildTypes {

            // This code block is adding app version at apk file
            applicationVariants.all { variant ->
                variant.outputs.each { output ->
                    output.outputFile = new File(
                            output.outputFile.parent,
                            output.outputFile.name.replace(".apk", "-${variant.versionName}.apk"))
                }
            }

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

            release {
                minifyEnabled true
                shrinkResources false
                zipAlignEnabled true
                debuggable false
                proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
            }

        }

        compileOptions
                {
                    encoding = 'windows-1251'// write your encoding here
                    sourceCompatibility JavaVersion.VERSION_1_8
                    targetCompatibility JavaVersion.VERSION_1_8
                }

        dataBinding {
            enabled = true
        }
    }
    repositories {
        maven { url "https://jitpack.io" }
        maven { url "https://repo.eclipse.org/content/repositories/paho-releases/" }
    }
    dependencies {
        compile fileTree(include: ['*.jar'], dir: 'libs')
        "Library inclue"
    }

5 Answers 5

14

I fixed this issue by deleting the .gradle/ directory in the project dir and kicking off a new build.

Sign up to request clarification or add additional context in comments.

3 Comments

Android Studio 3.0 Canary 9 and com.android.tools.build:gradle:3.0.0-alpha9. This answer solved the problem.
This answer solved my problem too.(Android Studio 3.0 Canary 9 and com.android.tools.build:gradle:3.0.0-alpha9)
solved it for me, building from the command line. Although, I used mv .gradle .broken rather than deleting, just in case I needed to restore.
5

Delete root .build and .idea directories. Make project again solved this problem. However it took me 24 mins to build the project.

Comments

1

Deleting the build/ directory in my project root and the build/ directory of all my modules solved it.

1 Comment

Thank you for reply and up vote you answer. but in my case sometimes not work your answer.
0

Complete uninstall Android studio

I didn't find any solution or not work for me.

So I uninstall all Android studio resource refer to upper link. And reinstall Android studio not contain SDK. (SDK install manually)

Comments

-1

Seems to be fixed in Studio 2.3 Beta 1.

In my specific scenario invoking ./gradlew :app:installDebug once after switching flavors fixed the issue temporarily.

1 Comment

Thank you for replay. But the results are the same.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.