Skip to content

Instantly share code, notes, and snippets.

@locskot
Created November 12, 2019 12:43
Show Gist options
  • Save locskot/a1064a9a99bd817d75079d76e37d6ce2 to your computer and use it in GitHub Desktop.
Save locskot/a1064a9a99bd817d75079d76e37d6ce2 to your computer and use it in GitHub Desktop.
def PLUGIN = "url_launcher";
def ANDROIDX_WARNING = "flutterPluginsAndroidXWarning";
gradle.buildFinished { buildResult ->
if (buildResult.failure && !rootProject.ext.has(ANDROIDX_WARNING)) {
println ' *********************************************************'
println 'WARNING: This version of ' + PLUGIN + ' will break your Android build if it or its dependencies aren\'t compatible with AndroidX.'
println ' See https://goo.gl/CP92wY for more information on the problem and how to fix it.'
println ' This warning prints for all Android build failures. The real root cause of the error may be unrelated.'
println ' *********************************************************'
rootProject.ext.set(ANDROIDX_WARNING, true);
}
}
group 'io.flutter.plugins.urllauncher'
version '1.0-SNAPSHOT'
buildscript {
repositories {
google()
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.3.1'
}
}
rootProject.allprojects {
repositories {
google()
jcenter()
}
}
apply plugin: 'com.android.library'
android {
compileSdkVersion 28
defaultConfig {
minSdkVersion 16
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
}
lintOptions {
disable 'InvalidPackage'
}
testOptions {
unitTests.includeAndroidResources = true
}
}
dependencies {
compileOnly 'androidx.annotation:annotation:1.0.0'
testImplementation 'junit:junit:4.12'
testImplementation 'org.mockito:mockito-core:1.10.19'
testImplementation 'androidx.test:core:1.0.0'
testImplementation 'org.robolectric:robolectric:4.3'
}
// TODO(mklim): Remove this hack once androidx.lifecycle is included on stable. https://github.com/flutter/flutter/issues/42348
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 {
def lifecycle_version = "1.1.1"
compileOnly "android.arch.lifecycle:runtime:$lifecycle_version"
compileOnly "android.arch.lifecycle:common:$lifecycle_version"
compileOnly "android.arch.lifecycle:common-java8:$lifecycle_version"
}
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment