Home / Companies / RevenueCat / Blog / Post Details
Content Deep Dive

Introducing the RevenueCat Codegen Gradle Plugin: type safe entitlements and offerings on Android

Blog post from RevenueCat

Post Details
Company
Date Published
Author
Jaewoong Eum
Word Count
2,830
Language
English
Hacker News Points
-
Summary

RevenueCat's Codegen Gradle Plugin addresses the issue of using raw string keys for entitlements, offerings, and packages in Kotlin code by generating type-safe accessors through a build-time interaction with the RevenueCat API. This plugin enhances coding safety by converting dashboard keys into typed Kotlin properties, enabling IDE autocomplete and compile-time error detection for incorrect keys, thus preventing runtime bugs caused by typos or changes in the dashboard. The setup involves applying the plugin from the Maven Central repository and configuring it with essential properties like apiKey, projectId, and packageName. It offers options for caching and offline mode to maintain build efficiency without constant network dependency, and provides flexibility for developers by allowing dynamic updates from the RevenueCat backend without requiring immediate code changes or new releases. The plugin is ideal for projects with stable identifiers, turning potential runtime issues into compile-time checks, while allowing for dynamic offerings management where necessary.