4

I am currently in the process of developing an Instant app, for which I have restructured my monolithic app into feature modules. Everything was up and running till Android Studio canary 3, but after an update to Android Studio Canary 4 my project fails to build with the following error:

A problem was found with the configuration of task ':minimoBase:dataBindingExportBuildInfoDebugAndroidTest'.

> Directory '/Users/nayak.vishal/projectData/minimo_instant_app_project/putica-client-android-
native/minimoBase/build/intermediates/data-binding-info/androidTest/debug' 
specified for property 'xmlOutFolder' does not exist.
halfer
  • 19,824
  • 17
  • 99
  • 186
Vishy
  • 548
  • 7
  • 17

6 Answers6

8

The following procedure worked as a workaround for this issue:

Execute the following build commands on the gradle command line

1) gradlew clean

2) gradlew :appModule:assembleDebug

  • here appModule is the name of the app module for building the installable apk
  • the build is successful and the debug apk generated in the output folder can be installed successfully

3) gradlew :instantAppModule:assembleDebug

  • here instantAppModule is the name of the instant app module
  • the build is successful and the instant app apks can be installed and launched via deep link

Once the above command line builds are successful, building via Android Studio Canary 4 also stops throwing the build error.

Vishy
  • 548
  • 7
  • 17
  • These links should help :) https://docs.gradle.org/0.9-rc-2/userguide/tutorial_gradle_command_line.html https://developer.android.com/studio/build/building-cmdline.html – Vishy Jul 26 '17 at 00:40
6

I got similar error when I turn on data-binding for library module. When I turn it off and move all classes that require data-binding to app module, it works. So I guess there is a problem that DataBinding doesn't work on Library module any more ( Gradle 2.x fine with this).

dataBinding {
    enabled = false 
}

I am using com.android.tools.build:gradle:3.0.0-alpha5 and Android Studio 3.0 Preview Canary5

UPDATE

Although the original answer worked, I really want to turn on data-binding on my library module, where I implement some base classes using binding technique. I move them back to library module and upgrade kotlin version to the latest one 1.1.3-2. Suddenly it works also. I am not sure which one is the better but both ways work for me.

UPDATE 2

I am using com.android.tools.build:gradle:3.0.0-alpha9 and kotlin 1.1.3-2 at this time and suddenly the problem re-appear. Now I think the problem doesn't come from Kotlin. My library module turned dataBiding { enabled=true}, but it doesn't have any layout file. I tried to create a fake layout file wrapped by <layout> tag and it works

 <?xml version="1.0" encoding="utf-8"?>
<layout>
    <View xmlns:android="http://schemas.android.com/apk/res/android"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:orientation="vertical"/>
</layout>
Community
  • 1
  • 1
Nguyen Minh Binh
  • 23,891
  • 30
  • 115
  • 165
  • I was facing the same issue in AS 3.0 Canary-6. You solution resolved my issue. Thanks for the update. Actually by default data binding was true in the project. – Custadian Jul 17 '17 at 06:46
3

In your gradle.properties file , add the following line

android.enableAapt2=false

Recent versions of AS3.0 switched to using AAPT2 by default. You can disable AAPT2 in your gradle.propertіes fіle with above mentioned line of code, and continue developing on AS3 canary 4.

Udit Kapahi
  • 2,277
  • 1
  • 27
  • 25
3

This was an issue for me when I had a "base" feature module without any layouts (all my actual layouts are in separate features)

Adding a dummy layout XML file in the base feature (e.g. as base/src/res/layout/dummy.xml) meant the missing directory was created and the app compiled.

(this is using com.android.tools.build:gradle:3.0.0-alpha6)

  • 1
    This was the exact problem that I had. Thanks for pointing out. – tasomaniac Jul 23 '17 at 12:09
  • @pete-harris is right. You should add at least one layout using as root element "layout" - the data binding root element for views. So, if you have none databinding layout configured, try to create one, like this: ` ` – marciowb Aug 02 '17 at 02:27
2

I've had the same problem, seems like a bug in Canary 4.

For now, as a workaround, I downgraded to Android Studio 3.0.0 Canary 3 (This is an archive of all Android Studio releases) and also downgraded the Android Gradle plugin to 3.0.0-alpha3:

dependencies {
    classpath 'com.android.tools.build:gradle:3.0.0-alpha3'
    ...
}
Prags
  • 2,457
  • 2
  • 21
  • 38
milanbarta
  • 21
  • 3
1

Updated:

Just check the Canary version after update. For that see Android Studio version just above the toolbar (File..Edit..View..line) where name at end like "Canary X".-> X is number like 3,4,5,etc.

For example suppose updated version(X) is 5. Try to change that classpath in build.gradle(applicationName) to 3.0.0-alpha5 and sync(/Try) again:

dependencies {
    classpath 'com.android.tools.build:gradle:3.0.0-alpha5'
}

Means that updated version(X):-

dependencies {
    classpath 'com.android.tools.build:gradle:3.0.0-alphaX'
}
Nitin Patel
  • 1,605
  • 13
  • 31
  • Thanks for your reply. Yes the gradle plugin version is already gradle:3.0.0-alpha4 and the distributionURL in gradle wrapper properties is set to gradle-4.0-rc-1-all.zip. This is auto prompted by Android Studio on update to Canay 4. So I don't think this is the reason for the build error. – Vishy Jun 26 '17 at 06:54
  • incorrectly. I still got same error when changing the gradle version – Nguyen Minh Binh Jul 04 '17 at 02:11