Skip to content

Instantly share code, notes, and snippets.

@blasten
Last active July 8, 2022 15:34
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save blasten/78e97b1d97a736d7e8dcc3f520cea3f0 to your computer and use it in GitHub Desktop.
Save blasten/78e97b1d97a736d7e8dcc3f520cea3f0 to your computer and use it in GitHub Desktop.
Add lifecycle dependency in build.gradle
afterEvaluate {
def containsEmbeddingDependencies = false
for (def configuration : configurations.all) {
for (def dependency : configuration.dependencies) {
if (dependency.group == 'io.flutter' &&
dependency.name.startsWith('flutter_embedding') &&
dependency.isTransitive())
{
containsEmbeddingDependencies = true
break
}
}
}
if (!containsEmbeddingDependencies) {
android {
dependencies {
// add lifecycle dependencies
}
}
}
}
@mklim
Copy link

mklim commented Oct 10, 2019

// add lifecycle dependencies

Should be:

     def lifecycle_version = "2.1.0"
     api "androidx.lifecycle:lifecycle-common-java8:$lifecycle_version"
     api "androidx.lifecycle:lifecycle-runtime:$lifecycle_version"

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment