Emoji2

Display emoji in current and older devices.
Latest Update Stable Release Release Candidate Beta Release Alpha Release
December 13, 2023 1.4.0 - - 1.5.0-alpha01

Declaring dependencies

To add a dependency on Emoji2, you must add the Google Maven repository to your project. Read Google's Maven repository for more information.

Add the dependencies for the artifacts you need in the build.gradle file for your app or module:

Groovy

dependencies {
    def emoji2_version = "1.4.0"

    implementation "androidx.emoji2:emoji2:$emoji2_version"
    implementation "androidx.emoji2:emoji2-views:$emoji2_version"
    implementation "androidx.emoji2:emoji2-views-helper:$emoji2_version"
}

Kotlin

dependencies {
    val emoji2_version = "1.4.0"

    implementation("androidx.emoji2:emoji2:$emoji2_version")
    implementation("androidx.emoji2:emoji2-views:$emoji2_version")
    implementation("androidx.emoji2:emoji2-views-helper:$emoji2_version")
}

For more information about dependencies, see Add Build Dependencies.

Feedback

Your feedback helps make Jetpack better. Let us know if you discover new issues or have ideas for improving this library. Please take a look at the existing issues in this library before you create a new one. You can add your vote to an existing issue by clicking the star button.

Create a new issue

See the Issue Tracker documentation for more information.

Emoji2 Emojipicker Version 1.0

Version 1.0.0-alpha03

March 8, 2023

androidx.emoji2:emoji2-emojipicker:1.0.0-alpha03 is released. Version 1.0.0-alpha03 contains these commits.

Bug Fixes

  • Removed unnecessary resources and reduced library size by ~0.3M.

Version 1.0.0-alpha02

February 22, 2023

androidx.emoji2:emoji2-emojipicker:1.0.0-alpha02 is released. Version 1.0.0-alpha02 contains these commits.

API Changes

  • Added new API for java clients to be able to provide recent emojis. (I39d10)

Bug Fixes

  • Update emoji resources to support emoji 15.0 (Ib4eb3)
  • When picking an emoji from the popup window, update all identical emojis to the newly picked emoji (except the recent emoji row). Also announce the emoji when clicking. (I892c6)
  • Wait for emojicompat to load before showing the EmojiPickerView. (I29e03)

Version 1.0.0-alpha01

January 25, 2023

androidx.emoji2:emoji2-emojipicker:1.0.0-alpha01 is released. Version 1.0.0-alpha01 contains these commits.

New Features

  • Introduced an emoji picker which provides consistent user experience with the latest emojis across Android OS OEM devices and apps. It provides the latest emoji support and emoji picker UI including skin-tone variants and emoji compat support.

API Changes

  • Introduced EmojiPickerView class that provides up-to-date emojis in a vertical scrollable view with a clickable horizontal header.
  • The emoji picker grid columns can be set via XML attribute emojiGridColumns or function setEmojiGridColumns().
  • The emoji picker grid rows can be set via XML attribute emojiGridRows or function setEmojiGridRows().
  • The emoji picked listener can be set via setOnEmojiPickedListener() and the listener will be notified whenever the user clicked any emoji.
  • The recent emoji provider can be provided with setRecentEmojiProvider(). This is an optional function. If the recent emoji provider isn’t set, a default recent emoji provider will be used by the library. The default behavior is defined as follows: 1) all selected emojis will be saved per-app level in shared preferences. 2) the picker will display at most 3 rows of selected emojis, deduped, in reverse chronological order.
  • Introduced EmojiViewItem class that holds the displayed emoji and its emoji variants.
  • Introduced RecentEmojiProvider interface that can be implemented to provide a recent emoji list. The recentEmojiProvider is responsible for providing emojis in the “Recently Used” category.

Version 1.5

Version 1.5.0-alpha01

December 13, 2023

androidx.emoji2:emoji2-*:1.5.0-alpha01 is released. Version 1.5.0-alpha01 contains these commits.

New Features

  • emoji2-bundled contains an updated emoji font to support Emoji 15.1.

API Changes

  • Add executors to control the callback thread for InitCallback. (I32b67)
  • BundledEmojiCompatConfig now takes an executor to control loading threads. (I00e81)

Version 1.4

Version 1.4.0

August 9, 2023

androidx.emoji2:emoji2-*:1.4.0 is released. Version 1.4.0 contains these commits.

Important changes since 1.3.0

  • Introduced emoji picker library. Checkout the developer doc for more details.

Version 1.4.0-rc01

July 26, 2023

androidx.emoji2:emoji2-*:1.4.0-rc01 is released. Version 1.4.0-rc01 contains these commits.

API Changes

  • Introduce registerSource list (Iae92f)
  • API Council feedback: renamed TransitionManager.seekTo() to createSeekController(). Please adjust previous comment about adding TransitionManager.seekTo() to TransitionManager.createSeekController(). (Idbeb1)
  • Added ExerciseRouteResult, which is not the superclass for Data, NoData and ConsentRequiredStates. Added ExerciseRoute as a standalone class, which holds location data for the route. (I22eed)
  • Introduced PagerLayoutInfo with information collected after a measure pass in Pager. Also introduced PageInfo, the information about a single measured Page in Pager. (Iad003, b/283098900)

Bug Fixes

  • We have updated the colors for Button, IconButton and TextButton in line with Material3 design. The semantic role for Button, IconButton and TextButton can now be overridden using Modifier.semantics. (Ib2495)
  • Fixed EmojiPickerView’s tab selection and indicator updates one click behind. (I4db04)
  • FileNotFoundException on showing the emoji picker (I353e4)
  • Catch the WindowManager.BadTokenException when using EmojiPickerView (I0a144)

Version 1.4.0-beta05

June 7, 2023

androidx.emoji2:emoji2-*:1.4.0-beta05 is released. Version 1.4.0-beta05 contains these commits.

Bug Fixes

  • Fixed a bug introduced in 1.3 that would cause MetricsAffectingSpans such as RelativeSizeSpan to apply twice. Once during text layout, and again inside of EmojiSpan.draw. The result was incorrectly sized draw, visible if any of the text size parameters were changed by the span. (b/283208650)

Version 1.4.0-beta04

May 24, 2023

androidx.emoji2:emoji2-*:1.4.0-beta04 is released. Version 1.4.0-beta04 contains these commits.

This release fixes a bug present since 1.0 where views with a non-main handler would throw an exception when attempting to update the emoji spans after font load completes. There is no workaround, if you are impacted by this bug please upgrade to this version or later.

Bug Fixes

  • EmojiCompat init callbacks will now use the handler from each view, respecting views not on the main thread. (Iccbcf)

Version 1.4.0-beta03

May 10, 2023

androidx.emoji2:emoji2-*:1.4.0-beta03 is released. Version 1.4.0-beta03 contains these commits.

Bug Fixes

  • Fix emoji picker nested popup view crash. (0acc8e)
  • Throw early exceptions in the EmojiCompat getEmojiStart/getEmojiEnd. (26177f)

Version 1.4.0-beta02

April 19, 2023

androidx.emoji2:emoji2-*:1.4.0-beta02 is released. Version 1.4.0-beta02 contains these commits.

Bug Fixes

  • Update lint baseline files (Iaa212)

Version 1.4.0-beta01

April 5, 2023

androidx.emoji2:emoji2-*:1.4.0-beta01 is released. Version 1.4.0-beta01 contains these commits.

New Features

androidx.emoji2:emoji2-emojipicker

The Emoji Picker is a UI solution that offers a modern look and feel, up-to-date emojis, and ease of use. Users can browse and select emojis and their variants, or choose from their recently used emojis. With this library, apps across different OEMs can provide an inclusive and unified emoji experience to their users without the developers having to build and maintain their own emoji picker from scratch.

Up-to-date Emojis

New emojis are released every year, and we will selectively include them in the Emoji Picker. To ensure backward compatibility, we perform an accurate emoji renderability check internally to eliminate tofu. This will ensure that the library is compatible across multiple Android versions and devices.

Sticky variants

Long-pressing an emoji will display a menu of variants, such as different genders or skin tones. The variant you choose will be saved in the emoji picker, and the last selected variant will be used in the main panel. With this feature, users can send their preferred emoji variants with just one tap.

Recent emoji

The RecentEmojiProvider is responsible for providing emojis in the “Recently Used” category. The library has a default recent emoji provider that satisfies the most common use case:

  • All selected emojis are saved per-app level in shared preferences.
  • The picker displays at most 3 rows of selected emojis, deduped, in reverse chronological order.

If this default behavior is sufficient, then you don't need to set the setRecentEmojiProvider() method.

Work with EmojiCompat

If the app has an EmojiCompat instance, it will be used in the emoji picker to render as many emojis as possible. If EmojiCompat is disabled, the emoji picker will still work fine.

How to use the library

To use the library, an app developer should

  1. Import androidx.emoji2:emojipicker:$version in build.gradle.

    dependencies {
      implementation "androidx.emoji2:emojipicker:$version"
    }
    
  2. Inflate the emoji picker view and optionally set emojiGridRows and emojiGridColumns based on the desired size of each emoji cell

    • You could leave them unset, the default is 9 emojiGridColumns, rows will be calculated based on the parent view height and emojiGridColumns
    • You could set emojiGridRows as a float to indicate there’s more emojis if scroll down in XML
     <androidx.emoji2.emojipicker.EmojiPickerView
      android:id="@+id/emoji_picker"
      android:layout_width="match_parent"
      android:layout_height="match_parent"
      app:emojiGridColumns="9" />
    

in code

    val emojiPickerView = EmojiPickerView(context).apply {
        emojiGridColumns = 15
        layoutParams = ViewGroup.LayoutParams(
            ViewGroup.LayoutParams.MATCH_PARENT,
            ViewGroup.LayoutParams.MATCH_PARENT
        )
    }
    findViewById<ViewGroup>(R.id.emoji_picker_layout).addView(emojiPickerView)
  1. Assuming you would like to append the selected emojis to a EditText, use setOnEmojiPickedListener()

      emojiPickerView.setOnEmojiPickedListener {
          findViewById<EditText>(R.id.edit_text).append(it.emoji)
      }
    
  2. Optionally set RecentEmojiProvider, see sample app for an example implementation.

  3. Optionally customize styles. Create your own style to override common theme attributes and apply the style to the EmojiPickerView. For example, overriding colorControlNormal will change the category icon color.

      <style name="CustomStyle" >
          <item name="colorControlNormal">#FFC0CB</item>
      </style>
      <androidx.emoji2.emojipicker.EmojiPickerView
          android:id="@+id/emoji_picker"
          android:layout_width="match_parent"
          android:layout_height="match_parent"
          android:theme="@style/CustomStyle"
          app:emojiGridColumns="9" />
    

See sample app for an example implementation.

A full API surface can be found here.

Sample App

This sample app demonstrate basic use cases plus the following additional scenarios:

  • The view re-layouted because emojiGridRows and emojiGridColumns were reseted.
  • The recent emoji provider is overridden to sort by frequency.
  • Style customization.

API Changes

The Emoji Picker library has been updated with the following new APIs:

  • The EmojiPickerView class, which provides up-to-date emojis in a vertical scrollable view with a clickable horizontal header.
  • The ability to set the number of columns and rows in the emoji picker grid via XML attributes emojiGridColumns and emojiGridRows or the setEmojiGridColumns() and setEmojiGridRows() methods.
  • The ability to set an emoji picked listener via the setOnEmojiPickedListener() method. The listener will be notified whenever the user clicks any emoji.
  • The ability to provide a recent emoji provider via the setRecentEmojiProvider() method. This is an optional function. If the recent emoji provider is not set, a default recent emoji provider will be used by the library. The default behavior is defined as follows:
    • All selected emojis will be saved per-app level in shared preferences.
    • The picker will display at most 3 rows of selected emojis, deduped, in reverse chronological order.
  • The EmojiViewItem class, which holds the displayed emoji and its emoji variants.
  • The RecentEmojiProvider interface, which can be implemented to provide a recent emoji list. The recentEmojiProvider is responsible for providing emojis in the “Recently Used” category.
  • The RecentEmojiAsyncProvider interface, which can be implemented to provide a recent emoji list. The RecentEmojiAsyncProvider is responsible for providing emojis in the “Recently Used” category. This interface is equivalent to RecentEmojiProvider that allows clients to override the getRecentEmojiListAsync() method to provide recent emojis.
  • The RecentEmojiProviderAdapter class, which is an adapter for the RecentEmojiAsyncProvider and implements RecentEmojiProvider.

Version 1.4.0-alpha01

March 22, 2023

androidx.emoji2:emoji2-*:1.4.0-alpha01 is released. Version 1.4.0-alpha01 contains these commits.

Bug Fixes

  • Fix tests, disable flake tests, and clean ups.

Version 1.3

Version 1.3.0

March 22, 2023

androidx.emoji2:emoji2-*:1.3.0 is released. Version 1.3.0 contains these commits.

Important changes since 1.2.0

  • This release allows Compose Foundation 1.4.0 and higher to enable emoji2 integration.
  • It also allows features for replacing EmojiSpans with custom drawing code, as well as support for emoji exclusions defined on Android.

Version 1.3.0-rc01

March 8, 2023

androidx.emoji2:emoji2-*:1.3.0-rc01 is released. Version 1.3.0-rc01 contains these commits.

New Features

  • This version is to support emoji2 compose integration.

API Changes

  • Replace spans for custom drawing code.
  • Querying system exclusions.

Bug Fixes

  • And fixed a bug where background spans were not correctly applied behind EmojiSopans.

Version 1.3.0-beta03

February 23, 2023

androidx.emoji2:emoji2-bundled:1.3.0-beta03, androidx.emoji2:emoji2-views:1.3.0-beta03, and androidx.emoji2:emoji2-views-helper:1.3.0-beta03 are released.

February 22, 2023

androidx.emoji2:emoji2:1.3.0-beta03 is released. Version 1.3.0-beta03 contains these commits.

New Features

  • No changes. This release is to prepare for compose integration.

Version 1.3.0-beta02

February 8, 2023

androidx.emoji2:emoji2-*:1.3.0-beta02 is released. Version 1.3.0-beta02 contains these commits.

New Features

  • This release is stabilization to support compose integration.

Version 1.3.0-beta01

January 25, 2023

androidx.emoji2:emoji2-*:1.3.0-beta01 is released. Version 1.3.0-beta01 contains these commits.

New Features

  • Querying system exclusions.
  • Replacing the spans for custom drawing code.
  • And fixed a bug where background spans were not correctly applied behind EmojiSopans.
  • This release adds APIs necessary to support EmojiCompat in Compose. Expect compose support for emoji compat in a near future release.

Version 1.3.0-alpha01

January 11, 2023

androidx.emoji2:emoji2-*:1.3.0-alpha01 is released. Version 1.3.0-alpha01 contains these commits.

New APIs for low level interactions

  • Querying system exclusions
  • Replacing the spans for custom drawing code
  • And fixed a bug where background spans were not correctly applied behind EmojiSopans.
  • This release adds APIs necessary to support EmojiCompat in Compose. Expect compose support for emoji compat in a near future release.

API Changes

  • Added ability to query system exclusions to TypefaceEmojiRasterizer. (I5653e)
  • Added new API EmojiCompat.SpanFactory for replacing default EmojiSpan behavior with custom drawing and sizing code. (Ib69d9)
  • Added EmojiCompat to Compose (I96f37, b/139326806)

Bug Fixes

Version 1.2

Version 1.2.0

August 10, 2022

androidx.emoji2:emoji2-*:1.2.0 is released. Version 1.2.0 contains these commits.

Important changes since 1.1.0

This is a bugfix release. No new features or APIs added since 1.1.0.

However, apps using PrecomputedText or TextView.setText(char[]) should prioritize bumping to this version.

The following bugs were fixed:

  • Emoji2 will add emoji to PrecomputedText by discarding previously precomputed text layout. (I47d06, b/211231958)
  • Backport editor crash fix from Android P to EditText that is configured to use emoji2. (Ifd709, b/216891011)
  • Fix crash when emoji2 loads font and TextView.setText(char[]) was used. (Id511e, b/206859724)

Version 1.2.0-rc01

July 27, 2022

androidx.emoji2:emoji2-*:1.2.0-rc01 is released. Version 1.2.0-rc01 contains these commits.

  • No changes since the last beta version.

Version 1.2.0-beta01

July 13, 2022

androidx.emoji2:emoji2-*:1.2.0-beta01 is released. Version 1.2.0-beta01 contains these commits.

New Features

  • No changes from the last version (this release is to support the AppCompat release).

Version 1.2.0-alpha04

April 20, 2022

androidx.emoji2:emoji2-*:1.2.0-alpha04 is released. Version 1.2.0-alpha04 contains these commits.

New Features

  • No changes in this release.

Version 1.2.0-alpha03

April 6, 2022

androidx.emoji2:emoji2-*:1.2.0-alpha03 is released. Version 1.2.0-alpha03 contains these commits.

New Features

  • No changes from the last version (this release is to support the appcompat release).

Version 1.2.0-alpha02

March 23, 2022

androidx.emoji2:emoji2-*:1.2.0-alpha02 is released. Version 1.2.0-alpha02 contains these commits.

Bug Fixes

  • Emoji2 will add emoji to PrecomputedText by discarding previously precomputed text layout. (I47d06, b/211231958)
  • Backport editor crash fix from Android P to EditText that is configured to use emoji2. (Ifd709, b/216891011)
  • Fix crash when emoji2 loads font and TextView.setText(char[]) was used. (Id511e, b/206859724)

Version 1.2.0-alpha01

February 23, 2022

androidx.emoji2:emoji2-*:1.2.0-alpha01 is released. Version 1.2.0-alpha01 contains these commits.

No changes since 1.1.0.

1.1

Version 1.1.0

February 23, 2022

androidx.emoji2:emoji2-*:1.1.0 is released. Version 1.1.0 contains these commits.

Important changes since 1.0.0

  • emoji2-bundled contains emoji 14 font
  • New getEmojiMatch API returns accurate information for keyboards to decide how an emoji will display in the presence of an emojicompat font that's behind the system font
  • Bugfix for NumberKeyListener that makes digit input correctly filter characters.

Version 1.1.0-rc01

February 9, 2022

androidx.emoji2:emoji2-*:1.1.0-rc01 is released. Version 1.1.0-rc01 contains these commits.

New Features

No changes from beta.

New features compared to emoji2 1.0.0:

  • emoji2-bundled contains emoji 14 font
  • New getEmojiMatch API returns accurate information for keyboards to decide how an emoji will display in the presence of an emojicompat font that's behind the system font
  • Bugfix for NumberKeyListener that makes digit input correctly filter characters

Version 1.1.0-beta01

January 26, 2022

androidx.emoji2:emoji2-*:1.1.0-beta01 is released. Version 1.1.0-beta01 contains these commits.

Bug Fixes

  • androidx-emoji2 beta01 release. No changes from alpha01 (Ic61d9)

Version 1.1.0-alpha01

December 15, 2021

androidx.emoji2:emoji2-*:1.1.0-alpha01 is released. Version 1.1.0-alpha01 contains these commits.

New Features

  • emoji2-bundled contains emoji 14 font
  • New getEmojiMatch API returns accurate information for keyboards to decide how an emoji will display in the presence of an emojicompat font that's behind the system font
  • Bugfix for NumberKeyListener that makes digit input correctly filter characters

API Changes

  • Add new API getEmojiMatch to allow keyboards to more accurately lookup emoji match behavior in emojicompat.
  • Deprecate hasEmojiGlyph, as its boolean return value is inaccurate when testing against a font that is older than the platform emoji font. Replace with getEmojiMatch. (Ie693d)

Bug Fixes

  • Emoji2 will not wrap instances of NumberKeyListener, allowing the locale to be configured by TextView.
  • Appcompat will not wrap instances of NumberKeyListener passed to setKeyListener, allowing TextView to correctly configure the locale on NumberKeyListeners. (Ibf113, b/207119921)

1.0

Version 1.0.1

December 15, 2021

androidx.emoji2:emoji2-*:1.0.1 is released. Version 1.0.1 contains these commits.

Bug Fixes

  • Emoji2 will not wrap instances of NumberKeyListener, allowing the locale to be configured by TextView.
  • Appcompat will not wrap instances of NumberKeyListener passed to setKeyListener, allowing TextView to correctly configure the locale on NumberKeyListeners. (Ibf113, b/207119921)

Version 1.0.0

November 17, 2021

androidx.emoji2:emoji2-*:1.0.0 is released. Version 1.0.0 contains these commits.

Major features of 1.0.0

androidx.emoji2 replaces androidx.emoji with additional capabilities:

  • APK size reduction vs androidx.emoji
  • Automatic configuration
  • Added as a dependency to appcompat 1.4

For more information about androidx.emoji2 see Supporting Modern Emoji and our Android Dev Summit talk Displaying ALL the emojis in your app Android Dev.

Version 1.0.0-rc01

October 27, 2021

androidx.emoji2:emoji2-*:1.0.0-rc01 is released. Version 1.0.0-rc01 contains these commits.

  • No changes since beta02.

Emoji2 Version 1.0.0-beta01

September 15, 2021

androidx.emoji2:emoji2-*:1.0.0-beta01 is released. Version 1.0.0-beta01 contains these commits.

API Changes

  • Added setLoadingExecutor to FontRequestEmojiCompatConfig, which replaces the previous API of setHandler. This API allows apps to configure FontRequestEmojiCompatConfig to use any background executor.

    This change is a breaking change from androidx.emoji:emoji, so setHandler is retained as a no-op Deprecated API to aid in migration. (I6cd48)

  • EmojiCompat correctly sets EditorInfo.extras on Android 11

    • Custom widgets that use IME not subclassing EditText may call EmojiCompat.updateEditorInfo to inform IME that they support EmojiCompat processing. (I1ea9b)

Bug Fixes

  • Fix DefaultEmojiCompatConfig to correctly lookup emoji font provider on API 19 and 28. This fixes a bug introduced in emoji2 1.0.0-alpha01. (Ib33d8, b/197906329)

Version 1.0.0-alpha03

June 30, 2021

androidx.emoji2:emoji2-*:1.0.0-alpha03 is released. Version 1.0.0-alpha03 contains these commits.

New Features

This release is a bugfix and stabilization release.

  1. EmojiEditTextHelper now allows null to be passed as a KeyListener. This allows the platform behavior of allowing nulls to be applied to emoji supporting EditText implementations.
  2. When using EmojiCompatInitializer initial startup delay is improved to trigger after the first Activity resumes. This allows app startup to happen uncontended, and avoids loading the font for app starts that never show a UI. After a short delay, EmojiCompat will create a thread to load the emoji font.
  • A new dependency on androidx.lifecycle:lifecycle-process from androidx.emoji2:emoji2 is added to implement the delay. This will have negligible APK size impact for apps that already include lifecycle (such as apps with appcompat).

API Changes

  • Allow null KeyListener in AppCompatEditText. This reverses the non-null annotation that was added to AppCompatEditText in 1.4.0-alpha01 and restores the previous behavior when passed null. (I21482, b/189559345)

Bug Fixes

  • Change EmojiCompatInitializer to delay font loading until 500ms after the first Activity.onResume. This allows an activity to perform Application.onCreate and Activity.onCreate uncontended, while still ensuring that the emoji font is loaded shortly after app startup. (I4bff7)

Version 1.0.0-alpha02

June 2, 2021

androidx.emoji2:emoji2:1.0.0-alpha02, androidx.emoji2:emoji2-views:1.0.0-alpha02, and androidx.emoji2:emoji2-views-helper:1.0.0-alpha02 are released. Version 1.0.0-alpha02 contains these commits.

API Changes

  • Renamed package in emoji2-views-helper to androidx.emoji2.viewsintegration. This is a breaking change for AppCompat 1.4.0-alpha01, and apps must ensure AppCompat dependency is updated to use the new emoji2 version. (Ie8397)

Version 1.0.0-alpha01

May 18, 2021

androidx.emoji2:emoji2:1.0.0-alpha01, androidx.emoji2:emoji2-views:1.0.0-alpha01, and androidx.emoji2:emoji2-views-helper:1.0.0-alpha01 are released. Version 1.0.0-alpha01 contains these commits.

Features in this initial release

Integrating emojicompat is recommended for all apps to support modern emoji from API19. All user generated content in your app contains 🎉.

EmojiCompat has moved from the androidx.emoji artifacts to the new androidx.emoji2, now in alpha01. The new artifacts replace the previous version.

emoji2 is added as a dependency to AppCompat starting in AppCompat 1.4.0-alpha01 and is enabled by default for AppCompat views.

The emoji2 artifact introduces a new automatic configuration using the androidx.startup library. You no longer need to write any 👨🏽‍💻 code to display 🐻‍❄️.

Changes in emoji2 from emoji

  • Added new automatic configuration EmojiCompatInitializer using androidx.startup.
  • Added new default configuration that uses service location to find a downloadable fonts provider in DefaultEmojiCompatConfiguration.
  • Classes moved from androidx.emoji package to androidx.emoji2.
  • Split EmojiTextView and related views to a separate artifact emoji2-views. This should only be used if your app doesn't use appcompat.
  • Extracted helpers for integrating emojicompat into custom views into a separate artifact emoji2-views-helper.
  • Added nullability annotations.
  • Helpers in emoji2-views-helper may now be used even when EmojiCompat is not initialized (previously they threw an exception).

What dependency should you add?

  • Apps with AppCompat should upgrade to appcompat version AppCompat 1.4.0-alpha01 or higher.
  • Apps without AppCompat using TextView/EditText from platform should use EmojiTextView and related classes from emoji2-views.

How to support in custom views

  • Apps with AppCompat should extend AppCompatTextView, AppCompatButton, etc. instead of platform TextView, etc.
  • Apps without AppCompat should add androidx.emoji2:emoji2-views-helper dependency and use helpers to integrate with custom TextView or EditText subclasses.

Configuring automatic initialization

  • Apps can disable the automatic initialization by adding this to the manifest:

     <provider
         android:name="androidx.startup.InitializationProvider"
         android:authorities="${applicationId}.androidx-startup"
         android:exported="false"
         tools:node="merge">
         <meta-data android:name="androidx.emoji2.text.EmojiCompatInitializer"
                   tools:node="remove" />
     </provider>
    
  • This disables automatic configuration, and you can then pass a custom configuration to EmojiCompat.init. The default configuration for the system may be retrieved DefaultEmojiCompatConfig.create(context) for further configuration before passing to EmojiCompat.init.