{"id":13451770,"url":"https://github.com/airbnb/epoxy","last_synced_at":"2026-01-24T01:18:35.335Z","repository":{"id":38710919,"uuid":"65245890","full_name":"airbnb/epoxy","owner":"airbnb","description":"Epoxy is an Android library for building complex screens in a RecyclerView","archived":false,"fork":false,"pushed_at":"2024-06-07T16:52:53.000Z","size":34091,"stargazers_count":8545,"open_issues_count":316,"forks_count":727,"subscribers_count":154,"default_branch":"master","last_synced_at":"2025-04-24T01:51:16.591Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"https://goo.gl/eIK82p","language":"Java","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/airbnb.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":"CONTRIBUTING.MD","funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2016-08-08T23:05:11.000Z","updated_at":"2025-04-24T01:50:30.000Z","dependencies_parsed_at":"2023-02-10T14:45:14.452Z","dependency_job_id":"20fcebe0-43f0-4ec0-8c95-7c8a4ce0cd85","html_url":"https://github.com/airbnb/epoxy","commit_stats":{"total_commits":470,"total_committers":89,"mean_commits":5.280898876404494,"dds":0.5361702127659574,"last_synced_commit":"c0813764351e4de97b7abd0694af5dad9db848f2"},"previous_names":[],"tags_count":78,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/airbnb%2Fepoxy","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/airbnb%2Fepoxy/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/airbnb%2Fepoxy/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/airbnb%2Fepoxy/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/airbnb","download_url":"https://codeload.github.com/airbnb/epoxy/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":253990466,"owners_count":21995774,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-07-31T07:01:01.931Z","updated_at":"2026-01-24T01:18:35.328Z","avatar_url":"https://github.com/airbnb.png","language":"Java","readme":"[![Build Status](https://travis-ci.com/airbnb/epoxy.svg?branch=master)](https://travis-ci.com/github/airbnb/epoxy)\n[![Maven Central](https://maven-badges.herokuapp.com/maven-central/com.airbnb.android/epoxy/badge.svg)](https://maven-badges.herokuapp.com/maven-central/com.airbnb.android/epoxy)\n[![GitHub license](https://img.shields.io/github/license/airbnb/epoxy)](https://github.com/airbnb/epoxy/blob/master/LICENSE)\n![GitHub contributors](https://img.shields.io/github/contributors/airbnb/epoxy)\n\n# Epoxy\n\nEpoxy is an Android library for building complex screens in a RecyclerView. Models are automatically generated from custom views or databinding layouts via annotation processing. These models are then used in an EpoxyController to declare what items to show in the RecyclerView.\n\nThis abstracts the boilerplate of view holders, diffing items and binding payload changes, item types, item ids, span counts, and more, in order to simplify building screens with multiple view types. Additionally, Epoxy adds support for saving view state and automatic diffing of item changes.\n\n[We developed Epoxy at Airbnb](https://medium.com/airbnb-engineering/epoxy-airbnbs-view-architecture-on-android-c3e1af150394#.xv4ymrtmk) to simplify the process of working with RecyclerViews, and to add the missing functionality we needed. We now use Epoxy for most of the main screens in our app and it has improved our developer experience greatly.\n\n* [Installation](#installation)\n* [Basic Usage](#basic-usage)\n* [Documentation](#documentation)\n* [Min SDK](#min-sdk)\n* [Contributing](#contributing)\n* [Sample App](https://github.com/airbnb/epoxy/wiki/Sample-App)\n\n## Installation\n\nGradle is the only supported build configuration, so just add the dependency to your project `build.gradle` file:\n\n```groovy\ndependencies {\n  implementation \"com.airbnb.android:epoxy:$epoxyVersion\"\n  // Add the annotation processor if you are using Epoxy's annotations (recommended)\n  annotationProcessor \"com.airbnb.android:epoxy-processor:$epoxyVersion\"\n}\n```\n\nReplace the variable `$epoxyVersion` with the latest version : [![Maven Central](https://maven-badges.herokuapp.com/maven-central/com.airbnb.android/epoxy/badge.svg)](https://maven-badges.herokuapp.com/maven-central/com.airbnb.android/epoxy)\n\nSee the [releases page](https://github.com/airbnb/epoxy/releases) for up to date release versions and details\n\n#### Kotlin with KAPT\nIf you are using Kotlin with KAPT you should also add\n```groovy\napply plugin: 'kotlin-kapt'\n\nkapt {\n    correctErrorTypes = true\n}\n```\n\nso that `AutoModel` annotations work properly. More information [here](https://github.com/airbnb/epoxy/wiki/Epoxy-Controller#usage-with-kotlin)\n\nAlso, make sure to use `kapt` instead of `annotationProcessor` in your dependencies in the `build.gradle` file.\n\n#### Kotlin with KSP (Recommended)\nKSP (Kotlin Symbol Processing) is recommended over KAPT as it is significantly faster.\n\nAdd the KSP plugin to your root `build.gradle`:\n```groovy\nplugins {\n    id 'com.google.devtools.ksp' version \"$KSP_VERSION\" apply false\n}\n```\n\nThen apply it in your module's `build.gradle`:\n```groovy\nplugins {\n    id 'com.android.application'\n    id 'kotlin-android'\n    id 'com.google.devtools.ksp'\n}\n\ndependencies {\n    implementation \"com.airbnb.android:epoxy:$epoxyVersion\"\n    ksp \"com.airbnb.android:epoxy-processor:$epoxyVersion\"\n}\n```\n\nYou can configure KSP processor options:\n```groovy\nksp {\n    // Validation and debugging\n    arg(\"validateEpoxyModelUsage\", \"true\")                // Validate model usage at runtime (default: true)\n    arg(\"logEpoxyTimings\", \"false\")                       // Log annotation processing timings (default: false)\n\n    // Code generation options\n    arg(\"epoxyDisableGenerateReset\", \"false\")             // Disable reset() method generation (default: false)\n    arg(\"epoxyDisableGenerateGetters\", \"false\")           // Disable getter generation (default: false)\n    arg(\"epoxyDisableGenerateOverloads\", \"false\")         // Disable builder overload generation (default: false)\n    arg(\"disableEpoxyKotlinExtensionGeneration\", \"false\") // Disable Kotlin extension generation (default: false)\n    arg(\"epoxyDisableDslMarker\", \"false\")                 // Disable DSL marker annotation (default: false)\n\n    // Model requirements\n    arg(\"requireHashCodeInEpoxyModels\", \"false\")          // Require hashCode/equals in models (default: false)\n    arg(\"requireAbstractEpoxyModels\", \"false\")            // Require abstract model classes (default: false)\n    arg(\"implicitlyAddAutoModels\", \"false\")               // Auto-add models to controllers (default: false)\n}\n```\n\n**Important:** DataBinding models are **not supported** with KSP, as Android's DataBinding library itself uses KAPT. If you need DataBinding support, you must continue using KAPT. For custom views with `@ModelView` or ViewHolder models, KSP works perfectly.\n\nSee the [epoxy-kspsample](https://github.com/airbnb/epoxy/tree/master/epoxy-kspsample) module for a complete working example.\n\n## Library Projects\nIf you are using layout resources in Epoxy annotations then for library projects add [Butterknife's gradle plugin](https://github.com/JakeWharton/butterknife#library-projects) to your `buildscript`.\n\n```groovy\nbuildscript {\n  repositories {\n    mavenCentral()\n  }\n  dependencies {\n    classpath 'com.jakewharton:butterknife-gradle-plugin:10.1.0'\n  }\n}\n```\n\nand then apply it in your module:\n```groovy\napply plugin: 'com.android.library'\napply plugin: 'com.jakewharton.butterknife'\n```\n\nNow make sure you use R2 instead of R inside all Epoxy annotations.\n```java\n@ModelView(defaultLayout = R2.layout.view_holder_header)\npublic class HeaderView extends LinearLayout {\n   ....\n}\n```\n\nThis is not necessary if you don't use resources as annotation parameters, such as with [custom view models](https://github.com/airbnb/epoxy/wiki/Generating-Models-from-View-Annotations).\n\n## Basic Usage\nThere are two main components of Epoxy:\n\n1. The `EpoxyModel`s that describe how your views should be displayed in the RecyclerView.\n2. The `EpoxyController` where the models are used to describe what items to show and with what data.\n\n### Creating Models\nEpoxy generates models for you based on your view or layout. Generated model classes are suffixed with an underscore (`_`) are used directly in your EpoxyController classes.\n\n#### From Custom Views\nAdd the `@ModelView` annotation on a view class. Then, add a \"prop\" annotation on each setter method to mark it as a property for the model.\n\n```java\n@ModelView(autoLayout = Size.MATCH_WIDTH_WRAP_HEIGHT)\npublic class HeaderView extends LinearLayout {\n\n  ... // Initialization omitted\n\n  @TextProp\n  public void setTitle(CharSequence text) {\n    titleView.setText(text);\n  }\n}\n```\n\nA `HeaderViewModel_` is then generated in the same package.\n\n[More Details](https://github.com/airbnb/epoxy/wiki/Generating-Models-from-View-Annotations)\n\n#### From DataBinding\n\nIf you use Android DataBinding you can simply set up your xml layouts like normal:\n\n```xml\n\u003clayout xmlns:android=\"http://schemas.android.com/apk/res/android\"\u003e\n    \u003cdata\u003e\n        \u003cvariable name=\"title\" type=\"String\" /\u003e\n    \u003c/data\u003e\n\n    \u003cTextView\n        android:layout_width=\"120dp\"\n        android:layout_height=\"40dp\"\n        android:text=\"@{title}\" /\u003e\n\u003c/layout\u003e\n```\n\nThen, create an interface or class in any package and add an `EpoxyDataBindingLayouts` annotation to declare your databinding layouts.\n\n```java\npackage com.airbnb.epoxy.sample;\n\nimport com.airbnb.epoxy.EpoxyDataBindingLayouts;\n\n@EpoxyDataBindingLayouts({R.layout.header_view, ... // other layouts })\ninterface EpoxyConfig {}\n```\n\nFrom this layout name Epoxy generates a `HeaderViewBindingModel_`.\n\n[More Details](https://github.com/airbnb/epoxy/wiki/Data-Binding-Support)\n\n#### From ViewHolders\nIf you use xml layouts without databinding you can create a model class to do the  binding.\n\n```java\n@EpoxyModelClass(layout = R.layout.header_view)\npublic abstract class HeaderModel extends EpoxyModelWithHolder\u003cHolder\u003e {\n  @EpoxyAttribute String title;\n\n  @Override\n  public void bind(Holder holder) {\n    holder.header.setText(title);\n  }\n\n  static class Holder extends BaseEpoxyHolder {\n    @BindView(R.id.text) TextView header;\n  }\n}\n```\n\nA `HeaderModel_` class is generated that subclasses HeaderModel and implements the model details.\n\n[More Details](https://github.com/airbnb/epoxy/wiki/ViewHolder-Models)\n\n### Using your models in a controller\n\nA controller defines what items should be shown in the RecyclerView, by adding the corresponding models in the desired order.\n\n The controller's `buildModels` method declares which items to show. You are responsible for calling `requestModelBuild` whenever your data changes, which triggers `buildModels` to run again. Epoxy tracks changes in the models and automatically binds and updates views.\n\nAs an example, our `PhotoController` shows a header, a list of photos, and a loader (if more photos are being loaded). The controller's `setData(photos, loadingMore)` method is called whenever photos are loaded, which triggers a call to `buildModels` so models representing the state of the new data can be built.\n\n```java\npublic class PhotoController extends Typed2EpoxyController\u003cList\u003cPhoto\u003e, Boolean\u003e {\n    @AutoModel HeaderModel_ headerModel;\n    @AutoModel LoaderModel_ loaderModel;\n\n    @Override\n    protected void buildModels(List\u003cPhoto\u003e photos, Boolean loadingMore) {\n      headerModel\n          .title(\"My Photos\")\n          .description(\"My album description!\")\n          .addTo(this);\n\n      for (Photo photo : photos) {\n        new PhotoModel()\n           .id(photo.id())\n           .url(photo.url())\n           .addTo(this);\n      }\n\n      loaderModel\n          .addIf(loadingMore, this);\n    }\n  }\n```\n\n#### Or with Kotlin\nAn extension function is generated for each model so we can write this:\n```kotlin\nclass PhotoController : Typed2EpoxyController\u003cList\u003cPhoto\u003e, Boolean\u003e() {\n\n    override fun buildModels(photos: List\u003cPhoto\u003e, loadingMore: Boolean) {\n        header {\n            id(\"header\")\n            title(\"My Photos\")\n            description(\"My album description!\")\n        }\n\n        photos.forEach {\n            photoView {\n                id(it.id())\n                url(it.url())\n            }\n        }\n\n        if (loadingMore) loaderView { id(\"loader\") }\n    }\n}\n```\n\n### Integrating with RecyclerView\n\nGet the backing adapter off the EpoxyController to set up your RecyclerView:\n```java\nMyController controller = new MyController();\nrecyclerView.setAdapter(controller.getAdapter());\n\n// Request a model build whenever your data changes\ncontroller.requestModelBuild();\n\n// Or if you are using a TypedEpoxyController\ncontroller.setData(myData);\n```\n\nIf you are using the [EpoxyRecyclerView](https://github.com/airbnb/epoxy/wiki/EpoxyRecyclerView) integration is easier.\n\n```java\nepoxyRecyclerView.setControllerAndBuildModels(new MyController());\n\n// Request a model build on the recyclerview when data changes\nepoxyRecyclerView.requestModelBuild();\n```\n\n#### Kotlin\nOr use [Kotlin Extensions](https://github.com/airbnb/epoxy/wiki/EpoxyRecyclerView#kotlin-extensions) to simplify further and remove the need for a controller class.\n```kotlin\nepoxyRecyclerView.withModels {\n        header {\n            id(\"header\")\n            title(\"My Photos\")\n            description(\"My album description!\")\n        }\n\n        photos.forEach {\n            photoView {\n                id(it.id())\n                url(it.url())\n            }\n        }\n\n        if (loadingMore) loaderView { id(\"loader\") }\n    }\n}\n```\n\n\n### More Reading\nAnd that's it! The controller's declarative style makes it very easy to visualize what the RecyclerView will look like, even when many different view types or items are used. Epoxy handles everything else. If a view only partially changes, such as the description, only that new value is set on the view, so the system is very efficient\n\nEpoxy handles much more than these basics, and is highly configurable. See [the wiki](https://github.com/airbnb/epoxy/wiki) for in depth documentation.\n\n## Documentation\nSee examples and browse complete documentation at the [Epoxy Wiki](https://github.com/airbnb/epoxy/wiki)\n\nIf you still have questions, feel free to create a new issue.\n\n## Min SDK\nWe support a minimum SDK of 14. However, Epoxy is based on the v7 support libraries so it should work with lower versions if you care to override the min sdk level in the manifest.\n\n## Contributing\nPull requests are welcome! We'd love help improving this library. Feel free to browse through open issues to look for things that need work. If you have a feature request or bug, please open a new issue so we can track it.\n\n## License\n\n```\nCopyright 2016 Airbnb, Inc.\n\nLicensed under the Apache License, Version 2.0 (the \"License\");\nyou may not use this file except in compliance with the License.\nYou may obtain a copy of the License at\n\n   http://www.apache.org/licenses/LICENSE-2.0\n\nUnless required by applicable law or agreed to in writing, software\ndistributed under the License is distributed on an \"AS IS\" BASIS,\nWITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\nSee the License for the specific language governing permissions and\nlimitations under the License.\n```\n","funding_links":[],"categories":["RecyclerView","Java"],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fairbnb%2Fepoxy","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fairbnb%2Fepoxy","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fairbnb%2Fepoxy/lists"}