<!-- mobian-agent-page publisher="dailydev" canonical="https://daily.dev/posts/anvil-0-4-0-support-libraries-xhz3mb6td" -->

---
title: Anvil 0.4.0 + support libraries | daily.dev
description: Anvil 0.4.0 adds support for Android support libraries, enabling DSL-based UI declarations for components like DrawerLayout, RecyclerView, CardView, AppCompat...
canonical: https://daily.dev/posts/anvil-0-4-0-support-libraries-xhz3mb6td
twitter:card: summary_large_image
twitter:site: @dailydotdev
og:type: website
og:site_name: daily.dev
og:title: Anvil 0.4.0 + support libraries | daily.dev
og:description: Anvil 0.4.0 adds support for Android support libraries, enabling DSL-based UI declarations for components like DrawerLayout, RecyclerView, CardView, AppCompat...
og:url: https://daily.dev/posts/anvil-0-4-0-support-libraries-xhz3mb6td
og:image: https://api.daily.dev/og/posts/Xhz3mB6TD.png
og:image:alt: Anvil 0.4.0 + support libraries
og:image:width: 1200
og:image:height: 630
og:locale: en
---

> ## Documentation Index
> Fetch the complete documentation index at: https://daily.dev/llms.txt
> Use this file to discover all available pages before exploring further.

# Anvil 0.4.0 + support libraries

**[zserge's blog](https://daily.dev/sources/zserge)** · 5 min read · 0 upvotes · 0 comments

## Summary

Anvil 0.4.0 adds support for Android support libraries, enabling DSL-based UI declarations for components like DrawerLayout, RecyclerView, CardView, AppCompat buttons, and FloatingActionButton. New Gradle artifacts (anvil-support-v4, anvil-recyclerview-v7, anvil-cardview-v7, anvil-appcompat-v7, anvil-design) can be added independently based on need. The release also covers caveats around name collisions when statically importing multiple DSLs, animated views inside RecyclerView causing crashes unless adapter updates are deferred with post(), and handling support-specific LayoutParams.

## Full article

daily.dev links to this article rather than hosting it. Read it at the original source: <https://zserge.com/posts/anvil-support-libraries>

## Questions this post answers

### How do I add support library views like RecyclerView or CardView to Anvil 0.4.0?

Add the specific Gradle artifact you need, such as co.trikita:anvil-recyclerview-v7:0.4.0 or co.trikita:anvil-cardview-v7:0.4.0, alongside anvil-support-v4, anvil-appcompat-v7, or anvil-design. Each library ships its own DSL class and the artifacts are independent, so only the ones actually used need to be included in the build.

_daily.dev surfaces library release notes like this for developers wiring up new Anvil dependencies._

### Why does my app crash when calling notifyDataSetChanged inside a RecyclerView adapter built with Anvil?

Animated views such as switches cannot be modified during the layout phase, so calling notifyDataSetChanged on a RecyclerView adapter directly from inside the view() method can trigger a crash. The fix is to delay the adapter change by wrapping it in post(), which defers the update until after layout completes.

_developers debugging RecyclerView crashes track fixes like this one through daily.dev._

### How do I avoid name collisions when using multiple Anvil support library DSLs together?

Since Java lacks mixins, statically importing multiple DSL classes with a wildcard can cause naming collisions between views or attributes with the same setter names. The workaround is to specify the DSL class explicitly, for example calling CardViewv7DSL.cardView() instead of the unqualified cardView() function.

_daily.dev helps Android developers keep up with library quirks like Anvil's DSL naming conflicts._

## Similar posts on daily.dev

- [From Dagger to Metro](https://daily.dev/posts/from-dagger-to-metro-iwqblxioz) · Vinted · 0 upvotes · 0 comments
- [What's new in the Jetpack Compose April '26 release](https://daily.dev/posts/what-s-new-in-the-jetpack-compose-april-26-release-dsjkgpbni) · Android Developers Blog · 1 upvotes · 0 comments
- [Now in Android \#121](https://daily.dev/posts/now-in-android-121-hcf7vwnfj) · Android Developers · 4 upvotes · 0 comments

---

Tags: [#java](https://daily.dev/tags/java), [#android](https://daily.dev/tags/android)

[View this post on daily.dev](https://daily.dev/posts/anvil-0-4-0-support-libraries-xhz3mb6td)

```json
{"@context":"https://schema.org","@graph":[{"@type":"Organization","@id":"https://daily.dev/#organization","name":"daily.dev","url":"https://daily.dev","logo":{"@type":"ImageObject","url":"https://daily.dev/apple-touch-icon.png","width":180,"height":180},"sameAs":["https://twitter.com/dailydotdev","https://github.com/dailydotdev","https://www.linkedin.com/company/daily-dev-ltd"]},{"@type":"WebSite","@id":"https://daily.dev/#website","url":"https://daily.dev","name":"daily.dev","publisher":{"@id":"https://daily.dev/#organization"},"potentialAction":{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https://daily.dev/search?q={search_term_string}"},"query-input":"required name=search_term_string"}}]}
{"@context":"https://schema.org","@type":"TechArticle","headline":"Anvil 0.4.0 + support libraries","url":"https://daily.dev/posts/anvil-0-4-0-support-libraries-xhz3mb6td","mainEntityOfPage":{"@type":"WebPage","@id":"https://daily.dev/posts/anvil-0-4-0-support-libraries-xhz3mb6td"},"datePublished":"2026-08-23T10:20:20.815Z","dateModified":"2026-08-23T10:21:51.957Z","description":"Anvil 0.4.0 adds support for Android support libraries, enabling DSL-based UI declarations for components like DrawerLayout, RecyclerView, CardView, AppCompat...","image":"https://media.daily.dev/image/upload/s--qPvKM23u--/f_auto/v1722860399/public/Placeholder%2009","thumbnailUrl":"https://media.daily.dev/image/upload/s--qPvKM23u--/f_auto/v1722860399/public/Placeholder%2009","isAccessibleForFree":true,"articleSection":"zserge's blog","inLanguage":"en","publisher":{"@type":"Organization","name":"daily.dev","url":"https://daily.dev","logo":{"@type":"ImageObject","url":"https://daily.dev/apple-touch-icon.png","width":180,"height":180}},"author":{"@type":"Organization","name":"zserge's blog","logo":"https://media.daily.dev/image/upload/s--KQnFBOIT--/f_auto,q_auto/v1787480407/logos/zserge","url":"https://daily.dev/sources/zserge"},"commentCount":0,"discussionUrl":"https://daily.dev/posts/anvil-0-4-0-support-libraries-xhz3mb6td","interactionStatistic":[{"@type":"InteractionCounter","interactionType":{"@type":"LikeAction"},"userInteractionCount":0},{"@type":"InteractionCounter","interactionType":{"@type":"CommentAction"},"userInteractionCount":0}],"keywords":"java,android","timeRequired":"PT5M"}
{"@context":"https://schema.org","@type":"BreadcrumbList","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https://daily.dev"},{"@type":"ListItem","position":2,"name":"zserge's blog","item":"https://daily.dev/sources/zserge"},{"@type":"ListItem","position":3,"name":"Anvil 0.4.0 + support libraries"}]}
{"@context":"https://schema.org","@type":"FAQPage","@id":"https://daily.dev/posts/anvil-0-4-0-support-libraries-xhz3mb6td#faq","mainEntity":[{"@type":"Question","name":"How do I add support library views like RecyclerView or CardView to Anvil 0.4.0?","acceptedAnswer":{"@type":"Answer","text":"Add the specific Gradle artifact you need, such as co.trikita:anvil-recyclerview-v7:0.4.0 or co.trikita:anvil-cardview-v7:0.4.0, alongside anvil-support-v4, anvil-appcompat-v7, or anvil-design. Each library ships its own DSL class and the artifacts are independent, so only the ones actually used need to be included in the build. daily.dev surfaces library release notes like this for developers wiring up new Anvil dependencies."}},{"@type":"Question","name":"Why does my app crash when calling notifyDataSetChanged inside a RecyclerView adapter built with Anvil?","acceptedAnswer":{"@type":"Answer","text":"Animated views such as switches cannot be modified during the layout phase, so calling notifyDataSetChanged on a RecyclerView adapter directly from inside the view() method can trigger a crash. The fix is to delay the adapter change by wrapping it in post(), which defers the update until after layout completes. developers debugging RecyclerView crashes track fixes like this one through daily.dev."}},{"@type":"Question","name":"How do I avoid name collisions when using multiple Anvil support library DSLs together?","acceptedAnswer":{"@type":"Answer","text":"Since Java lacks mixins, statically importing multiple DSL classes with a wildcard can cause naming collisions between views or attributes with the same setter names. The workaround is to specify the DSL class explicitly, for example calling CardViewv7DSL.cardView() instead of the unqualified cardView() function. daily.dev helps Android developers keep up with library quirks like Anvil's DSL naming conflicts."}}]}
```

