{"id":13610584,"url":"https://github.com/line/feature-flag-android","last_synced_at":"2026-01-07T03:15:17.326Z","repository":{"id":48421428,"uuid":"221108109","full_name":"line/feature-flag-android","owner":"line","description":"A Gradle plugin to achieve feature flag based development for Android applications.","archived":false,"fork":false,"pushed_at":"2025-01-10T06:33:41.000Z","size":497,"stargazers_count":106,"open_issues_count":3,"forks_count":10,"subscribers_count":11,"default_branch":"master","last_synced_at":"2025-03-30T18:35:33.675Z","etag":null,"topics":["android-development","feature-flags","feature-toggles","gradle-plugin"],"latest_commit_sha":null,"homepage":"","language":"Kotlin","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/line.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE","code_of_conduct":"CODE_OF_CONDUCT.md","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":"2019-11-12T02:01:19.000Z","updated_at":"2025-02-26T11:17:22.000Z","dependencies_parsed_at":"2024-08-01T19:44:12.093Z","dependency_job_id":"40314cbd-ad2b-4f01-a09d-a6032d7377db","html_url":"https://github.com/line/feature-flag-android","commit_stats":null,"previous_names":[],"tags_count":9,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/line%2Ffeature-flag-android","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/line%2Ffeature-flag-android/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/line%2Ffeature-flag-android/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/line%2Ffeature-flag-android/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/line","download_url":"https://codeload.github.com/line/feature-flag-android/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248642308,"owners_count":21138350,"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":["android-development","feature-flags","feature-toggles","gradle-plugin"],"created_at":"2024-08-01T19:01:46.097Z","updated_at":"2026-01-07T03:15:17.321Z","avatar_url":"https://github.com/line.png","language":"Kotlin","funding_links":[],"categories":["Kotlin"],"sub_categories":[],"readme":"# feature-flag-android\n\n[![Gradle Plugin Portal](https://img.shields.io/maven-metadata/v/https/plugins.gradle.org/m2/com/linecorp/android/feature-flag/com.linecorp.android.feature-flag.gradle.plugin/maven-metadata.xml.svg?colorB=007ec6\u0026label=Gradle%20Plugin%20Portal)](https://plugins.gradle.org/plugin/com.linecorp.android.feature-flag)\n\nA Gradle plugin to achieve feature flag based development for Android applications.\n\n## Overview\n\nThis plugin generates feature flags from a property file to achieve feature flag based development.\nThe flag values are visible as boolean values in source code, and useful to enable or disable features.\nYou can specify which feature is enabled by [build variant](https://developer.android.com/studio/build/build-variants), user name, [application version](https://developer.android.com/studio/publish/versioning), another flag value, and their combinations.\n\n## Getting started\n\n### Add library dependencies\n\nThe plugin is available on [Gradle Plugin Portal](https://plugins.gradle.org/). Add configurations in the `build.gradle.kts` file as follows.\n\n```build.gradle.kts\n// In your module's `build.gradle.kts`\nplugins {\n  id(\"com.linecorp.android.feature-flag\") version \"x.y.z\"\n}\n```\n\n### Add configuration\n\nWe assume this project has two build types: `debug` and `release` as follows.\n\n```build.gradle\nandroid {\n    buildTypes {\n        debug {\n            // snip\n        }\n        release {\n            // snip\n        }\n    }\n}\n```\n\nWe may define flag phases as follows, for example.\n\n- `DEBUG`: Enabled when the build type is `debug`.\n- `RELEASE`: Enabled when the build type is `debug` or `release`.\n\nThe following code is actual configuration example.\n\n```build.gradle.kts\nfeatureFlag {\n    sourceFiles.setFrom(file(\"FEATURE_FLAG\"))\n    // You can also specify multiple files as follows.\n    // sourceFiles.setFrom(files(\"FEATURE_FLAG\", \"FEATURE_FLAG_2\"))\n\n    packageName = \"com.example.featureflag\"\n    phases = mapOf(\n        \"DEBUG\" to setOf(buildType(\"debug\")),\n        \"RELEASE\" to setOf(buildType(\"debug\"), buildType(\"release\"))\n    )\n    releasePhaseSet = setOf(buildType(\"release\"))\n    versionNotation = VersionNotation.SEM_VER\n}\n```\n\nDefinition of each property is as follows.\n\n- `sourceFiles`: A set of feature flag property `File`s to read.\n- `packageName`: (Optional) A package name of generated `FeatureFlag` class. If this is not set, packageName will be set from `namespace` of Android Gradle Plugin\n- `phases`: A list of pairs of phase and the corresponding build variants.\n- `releasePhaseSet`: Build variants to allow using primitive boolean values as flag values. An optimizer may inline flag values with the variants. `buildType` or `flavor` can be specified as a variant.\n- `versionName`: (Optional) A version name which can override application version name.\n- `versionNotation`: (Optional) A value indicating how to interpret and compare version strings.\n    - `SEM_VER`: Using [Semantic Versioning 2.0.0](https://semver.org/).\n    - `SIMPLE`: Compare the numbers separated by dots from left to right.\n\n   Also, this property can be assigned for library module since Android Gradle Plugin 7.0 or higher.\n\n## How to use\n\n### Create property files\n\nCreate a feature flag property file in your module.\nAn example is as follows.\n\n```FEATURE_FLAG\n# Simple property\nFLAG_1 = DEBUG              # Enabled when build in `DEBUG` phase.\nFLAG_2 = 1.2.0~             # Enabled when module version is `1.2.0` or later.\nFLAG_3 = @user              # Enabled if the username is `user`.\nFLAG_4 = packageName:FLAG_A # Delegates flag enability to `FLAG_A` in module which has `packageName` as packageName property.\n\n# Property with options\nOVERRIDABLE FLAG_5 = DEBUG  # Makes the flag modifiable at runtime.\nPRIVATE FLAG_6 = DEBUG      # Makes the flag not accessible from a flag property file in another module.\nLITERALIZE FLAG_7 = DEBUG   # Try to use a primitive boolean as the flag value.\n\n# Property combination\n# Enabled if either of the following conditions satisfies\n# 1. Built in `DEBUG` phase.\n# 2. Built in `RELEASE` phase and version `1.3.0` or later.\nFLAG_8 = DEBUG, RELEASE \u0026 1.3.0~\n\n# Local flag reference\nPRIVATE FLAG_9_USERS = @user1, @user2  # Enabled if built by `user1` or `user2`\nFLAG_9 = :FLAG_9_USERS \u0026 DEBUG         # Enabled if `FLAG_9_USERS` is enabled and built in `DEBUG` phase.\n```\n\n### Use flag value from application code\n\n```kotlin\n// Change view visibility\nview.isVisible = FeatureFlag.FLAG_1\n\n// Change activity\nval targetActivityClass = if(FeatureFlag.FLAG_2) FooActivity::class.java else BarActivity::class.java\nval intent = Intent(context, targetActivityClass)\n\n// Change presenter\nval presenter = if (FeatureFlag.FLAG_3) FooPresenter() else BarPresenter()\npresenter.show()\n\n// Modify the flag value programmatically (available when it's `OVERRIDABLE`)\nFeatureFlag.FLAG_5 = false\n```\n\n## IntelliJ Plugin\n\nWe also provide [FeatureFlag Android Support](https://plugins.jetbrains.com/plugin/25573-featureflag-android-support), an IDE Plugin to support this `FEATURE_FLAG` file in IntelliJ IDEs including Android Studio.\n\nSee [here](intellij-plugin/README.md) for an overview and installation instructions.\n\n## How to contribute\n\nSee [CONTRIBUTING.md](CONTRIBUTING.md).\n\nIf you believe you have discovered a vulnerability or have an issue related to security, please contact the maintainer directly or send us a email to dl_oss_dev@linecorp.com before sending a pull request.\n\n## LICENSE\n\n```\nCopyright 2019 LINE Corporation\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\nSee [LICENSE](LICENSE) for more detail.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fline%2Ffeature-flag-android","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fline%2Ffeature-flag-android","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fline%2Ffeature-flag-android/lists"}