Skip to main content

Getting Started

Adding Litho to your Project#

We publish the Litho artifacts to Bintray's JCenter. To include Litho to your Android project, make sure you include the reference to the repository in your build.gradle file:

repositories {  jcenter()}

Then add the dependencies like this:

dependencies {
// ...
// Litho
implementation 'com.facebook.litho:litho-core:0.40.0'
implementation 'com.facebook.litho:litho-widget:0.40.0'
annotationProcessor 'com.facebook.litho:litho-processor:0.40.0'
// SoLoader
implementation 'com.facebook.soloader:soloader:0.9.0'
// For integration with Fresco
implementation 'com.facebook.litho:litho-fresco:0.40.0'
// For testing
testImplementation 'com.facebook.litho:litho-testing:0.40.0'
}

Adding Sections to your Project#

Litho comes with an optional library called Sections for declaratively building lists. You can include Sections by adding the following additional dependencies to your build.gradle file:

dependencies {
// Sections
implementation 'com.facebook.litho:litho-sections-core:0.40.0'
implementation 'com.facebook.litho:litho-sections-widget:0.40.0'
compileOnly 'com.facebook.litho:litho-sections-annotations:0.40.0'
annotationProcessor 'com.facebook.litho:litho-sections-processor:0.40.0'
}

Using Snapshot releases#

caution

This will break and may set your house on fire. Snapshots are unsigned and automatically published by our CI system. Use them for testing purposes only.

First, add the Sonatype Snapshots repository to your gradle config:

repositories {  maven { url "https://oss.sonatype.org/content/repositories/snapshots/" }}

Then you can access the snapshot versions of all Litho artifacts that we publish:

dependencies {
// ...
// Litho
implementation 'com.facebook.litho:litho-core:0.40.1-SNAPSHOT'
implementation 'com.facebook.litho:litho-widget:0.40.1-SNAPSHOT'
annotationProcessor 'com.facebook.litho:litho-processor:0.40.1-SNAPSHOT'
// SoLoader
implementation 'com.facebook.soloader:soloader:0.9.0'
// For integration with Fresco
implementation 'com.facebook.litho:litho-fresco:0.40.1-SNAPSHOT'
// For testing
testImplementation 'com.facebook.litho:litho-testing:0.40.1-SNAPSHOT'
}