Skip to content

Commit 466f2e1

Browse files
committed
added androidX support
1 parent 2cc5b03 commit 466f2e1

File tree

4 files changed

+23
-9
lines changed

4 files changed

+23
-9
lines changed

android/build.gradle

Lines changed: 15 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,26 @@
11
group 'com.flutter_webview_plugin'
22
version '1.0-SNAPSHOT'
33

4+
def ANDROIDX_WARNING = "flutterPluginsAndroidXWarning";
5+
gradle.buildFinished { buildResult ->
6+
if (buildResult.failure && !rootProject.ext.has(ANDROIDX_WARNING)) {
7+
println ' *********************************************************'
8+
println 'WARNING: This version of flutter_webview_plugin will break your Android build if it or its dependencies aren\'t compatible with AndroidX.'
9+
println ' See https://goo.gl/CP92wY for more information on the problem and how to fix it.'
10+
println ' This warning prints for all Android build failures. The real root cause of the error may be unrelated.'
11+
println ' *********************************************************'
12+
rootProject.ext.set(ANDROIDX_WARNING, true);
13+
}
14+
}
15+
416
buildscript {
517
repositories {
618
google()
719
jcenter()
820
}
921

1022
dependencies {
11-
classpath 'com.android.tools.build:gradle:3.2.1'
23+
classpath 'com.android.tools.build:gradle:3.3.2'
1224
}
1325
}
1426

@@ -21,10 +33,10 @@ allprojects {
2133
apply plugin: 'com.android.library'
2234

2335
android {
24-
compileSdkVersion 27
36+
compileSdkVersion 28
2537

2638
defaultConfig {
27-
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
39+
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
2840
// NOTE(jeffmikels): When targetSdkVersion or minSdkVersion is not set or < 4, gradle adds
2941
// additional scary permissions such as WRITE_EXTERNAL_STORAGE and READ_PHONE_STATE.
3042
minSdkVersion 16

example/android/app/build.gradle

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ apply plugin: 'com.android.application'
1515
apply from: "$flutterRoot/packages/flutter_tools/gradle/flutter.gradle"
1616

1717
android {
18-
compileSdkVersion 27
18+
compileSdkVersion 28
1919

2020
lintOptions {
2121
disable 'InvalidPackage'
@@ -42,7 +42,7 @@ flutter {
4242
}
4343

4444
dependencies {
45-
androidTestImplementation 'com.android.support:support-annotations:27.0.0'
46-
androidTestImplementation 'com.android.support.test:runner:1.0.2'
47-
androidTestImplementation 'com.android.support.test:rules:1.0.2'
45+
androidTestImplementation 'androidx.annotation:annotation:1.0.2'
46+
androidTestImplementation 'androidx.test:runner:1.1.1'
47+
androidTestImplementation 'androidx.test:rules:1.1.1'
4848
}

example/android/build.gradle

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ buildscript {
88
}
99

1010
dependencies {
11-
classpath 'com.android.tools.build:gradle:3.2.1'
11+
classpath 'com.android.tools.build:gradle:3.3.2'
1212
}
1313
}
1414

@@ -33,5 +33,5 @@ task clean(type: Delete) {
3333
}
3434

3535
task wrapper(type: Wrapper) {
36-
gradleVersion = '2.14.1'
36+
gradleVersion = '4.10.2'
3737
}

example/android/gradle.properties

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1 +1,3 @@
11
org.gradle.jvmargs=-Xmx1536M
2+
android.useAndroidX=true
3+
android.enableJetifier=false

0 commit comments

Comments
 (0)