Data Bindingに触れてみた
気になったので試してみようと思った。
導入で記事を探していたら下記をgradleに追加すれば使えるって記事を多く見かけたので
記載して試してみた。
build.gradle/Project
dependencies {
classpath "com.android.tools.build:gradle:1.3.0-beta1"
classpath "com.android.databinding:dataBinder:1.0-rc0"
}
build.gradle/Module
apply plugin: 'com.android.databinding'
エラーが出た
Error:Unable to find method 'android.databinding.tool.LayoutXmlProcessor.<init>(Ljava/lang/String;Landroid/databinding/tool/writer/JavaFileWriter;IZLandroid/databinding/tool/LayoutXmlProcessor$OriginalFileLookup;)V'.
Possible causes for this unexpected error include:<ul><li>Gradle's dependency cache may be corrupt (this sometimes occurs after a network connection timeout.)
<a href="syncProject">Re-download dependencies and sync project (requires network)</a></li><li>The state of a Gradle build process (daemon) may be corrupt. Stopping all Gradle daemons may solve this problem.
<a href="stopGradleDaemons">Stop Gradle build processes (requires restart)</a></li><li>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.</li></ul>In the case of corrupt Gradle processes, you can also try closing the IDE and then killing all Java processes.
調べたら下記のgradleのverで統合されてたぽかった
classpath 'com.android.tools.build:gradle:1.5.0-alpha1
moduleでdataBindingを有効にしたらエラーが消えた
build.gradle/Module
dataBinding {
enabled = true
}
まとめ
次回以降触れて行こうと思う。