简体   繁体   中英

Do I need to add kapt “com.android.databinding:compiler:$compiler_version” gradle entry?

Theofficial documentation never mentions adding a dependency for data binding and neither does the sunflower app (which implements best practices) use it.

However, everywhere else I look (also here ) I see people mentioning to add the following (but never really explaining):

dependencies {
    ...
    kapt "com.android.databinding:compiler:$compiler_version"
}

I found this and my understanding is that the line above will help to reduce the apk size of the app. Is that really the case? Are there other benefits or should I just ignore this as the official docs and resources have?

That dependency is automatically added by enabling data binding. I think there were some Kotlin-related problems a few years ago (your linked-to resources are from 2017 and 2018), but they are fixed now. You do not need to add it manually.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM