2

Estou tentando utilizar o Data Binding no Android.

Para isto adicionei o classpath na aplicação:

buildscript {
    repositories {
        jcenter()
    }
    dependencies {
        classpath 'com.android.tools.build:gradle:2.1.0-beta3'
        classpath 'com.android.databinding:dataBinder:1.0-rc4'
    }
}


apply plugin: 'com.android.application'
apply plugin: 'com.android.databinding'

Mas quando tento compilar ocorre o seguinte erro:

Error:Unable to find method 'android.databinding.tool.LayoutXmlProcessor.(Ljava/lang/String;Landroid/databinding/tool/writer/JavaFileWriter;IZLandroid/databinding/tool/LayoutXmlProcessor$OriginalFileLookup;)V'. Possible causes for this unexpected error include:

  • Gradle's dependency cache may be corrupt (this sometimes occurs after a network connection timeout.) Re-download dependencies and sync project (requires network)
  • The state of a Gradle build process (daemon) may be corrupt. Stopping all Gradle daemons may solve this problem. Stop Gradle build processes (requires restart)
  • Your project may be using a third-party plugin which is not compatible with the other plugins in the project or the version of Gradle requested by the project.
In the case of corrupt Gradle processes, you can also try closing the IDE and then killing all Java processes.

Não sei se é realmente necessário adicionar estas informações, mas quando tento compilar apenas habilitando o databinding:

dataBinding {
        enabled true
    }

Ocorre o seguinte :

Error:(23, 23) No resource type specified (at 'text' with value '@{user.name}').

Alguém já utilizou este recurso com sucesso?

1 Resposta 1

1

Tente fazer isso:

dataBinding {
    enabled = true
}

Colocar = depois do enabled

Você deve fazer log-in para responder a esta pergunta.

Esta não é a resposta que você está procurando? Pesquise outras perguntas com a tag .