1
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 1 year has passed since last update.

DataBinding-ktx導入時の注意点

Posted at

はじめに

皆さんご存知、wada811さんが作成されている、DataBinding-ktxですが、非常に便利ですよね。
私もDataBindingでの実装の際はできる限り使用しているのですが、導入時にいつも通りimplementationを追加するだけだとビルドエラーとなってしまいます。
こちらちょっとした調整が必要なのですが、忘れてしまいそうなので、簡単にまとめておこうと思います。

調整内容

まず、以下を変わらず追加します。

implementation 'com.github.wada811:DataBinding-ktx:6.1.0'

バージョンは最新を使用いただいていいと思います。

次に同じくapplicationレベルのgradleに以下を追加します。

android {
    buildFeatures {
        dataBinding = true
    }
}

最後に、setting.gradleに以下コメント部分を追加します。

dependencyResolutionManagement {
    repositoriesMode.set(RepositoriesMode.FAIL_ON_PROJECT_REPOS)
    repositories {
        google()
        mavenCentral()
        // 追加
        maven { url "https://jitpack.io" }
    }
}

以上になります。

さいごに

こういう設定をうっかり忘れていると、意外とハマったりしますよね。
ちなみにallprojectsをprojectレベルのgradleに追加して対応しても解決できるかと思います。
こういった忘れる事で発生するコストをなるべく少なくしていく為に、どんどん記事にしておこうと思います。

1
1
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
1
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?