Skip to content

Commit 71fec05

Browse files
authored
flutter 3.0 support added (#295)
1 parent b2c54d6 commit 71fec05

File tree

11 files changed

+39
-38
lines changed

11 files changed

+39
-38
lines changed

android/build.gradle

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ group 'com.shatsy.admobflutter'
22
version '1.0.0-beta.3'
33

44
buildscript {
5-
ext.kotlin_version = '1.3.72'
5+
ext.kotlin_version = '1.6.10'
66
repositories {
77
google()
88
jcenter()
@@ -25,7 +25,7 @@ apply plugin: 'com.android.library'
2525
apply plugin: 'kotlin-android'
2626

2727
android {
28-
compileSdkVersion 28
28+
compileSdkVersion 31
2929

3030
sourceSets {
3131
main.java.srcDirs += 'src/main/kotlin'

android/src/main/kotlin/com/shatsy/admobflutter/AdmobBannerFactory.kt

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,8 @@ import io.flutter.plugin.common.StandardMessageCodec
66
import io.flutter.plugin.platform.PlatformView
77
import io.flutter.plugin.platform.PlatformViewFactory
88

9-
class AdmobBannerFactory(private val messenger: BinaryMessenger): PlatformViewFactory(StandardMessageCodec.INSTANCE) {
10-
override fun create(context: Context, viewId: Int, args: Any?): PlatformView {
11-
return AdmobBanner(context, messenger, viewId, args as HashMap<*, *>)
9+
class AdmobBannerFactory(private val messenger: BinaryMessenger): PlatformViewFactory(StandardMessageCodec.INSTANCE) {
10+
override fun create(context: Context?, viewId: Int, args: Any?): PlatformView {
11+
return AdmobBanner(context!!, messenger, viewId, args as HashMap<*, *>)
1212
}
1313
}

android/src/main/kotlin/com/shatsy/admobflutter/AdmobInterstitial.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ class AdmobInterstitial(private val flutterPluginBinding: FlutterPlugin.FlutterP
6060

6161
if (allAds[id]!!.isLoaded) {
6262
allAds[id]!!.show()
63-
} else result.error(null, null, null)
63+
} else result.error("2", null, null)
6464
}
6565
"dispose" -> {
6666
val id = call.argument<Int>("id")

android/src/main/kotlin/com/shatsy/admobflutter/AdmobReward.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ class AdmobReward(private val flutterPluginBinding: FlutterPlugin.FlutterPluginB
6363

6464
if (allAds[id]!!.isLoaded) {
6565
allAds[id]!!.show()
66-
} else result.error(null, null, null)
66+
} else result.error("2", null, null)
6767
}
6868
"dispose" -> {
6969
val id = call.argument<Int>("id")

example/android/app/build.gradle

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ apply plugin: 'kotlin-android'
2626
apply from: "$flutterRoot/packages/flutter_tools/gradle/flutter.gradle"
2727

2828
android {
29-
compileSdkVersion 28
29+
compileSdkVersion 31
3030

3131
sourceSets {
3232
main.java.srcDirs += 'src/main/kotlin'
@@ -38,8 +38,8 @@ android {
3838

3939
defaultConfig {
4040
applicationId "com.shatsy.admobflutterexample"
41-
minSdkVersion 16
42-
targetSdkVersion 28
41+
minSdkVersion flutter.minSdkVersion
42+
targetSdkVersion flutter.targetSdkVersion
4343
versionCode flutterVersionCode.toInteger()
4444
versionName flutterVersionName
4545
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"

example/android/app/src/main/AndroidManifest.xml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,8 @@
2020
android:name="com.google.android.gms.ads.APPLICATION_ID"
2121
android:value="ca-app-pub-3940256099942544~3347511713" />
2222

23-
<activity android:name=".MainActivity">
23+
<activity android:name=".MainActivity"
24+
android:exported="true">
2425
<intent-filter>
2526
<action android:name="android.intent.action.MAIN" />
2627
<category android:name="android.intent.category.LAUNCHER" />

example/android/build.gradle

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
buildscript {
2-
ext.kotlin_version = '1.3.40'
2+
ext.kotlin_version = '1.6.10'
33
repositories {
44
google()
55
jcenter()

example/lib/extensions.dart

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ class TopBannerAdAppRecipe extends StatelessWidget {
6363
return Directionality(
6464
textDirection: TextDirection.rtl,
6565
child: MediaQuery(
66-
data: MediaQueryData.fromWindow(WidgetsBinding.instance!.window),
66+
data: MediaQueryData.fromWindow(WidgetsBinding.instance.window),
6767
child: Container(
6868
color: Colors.blueGrey,
6969
child: Column(children: [

example/pubspec.lock

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ packages:
4949
name: collection
5050
url: "https://pub.dartlang.org"
5151
source: hosted
52-
version: "1.15.0"
52+
version: "1.16.0"
5353
cupertino_icons:
5454
dependency: "direct main"
5555
description:
@@ -63,7 +63,7 @@ packages:
6363
name: fake_async
6464
url: "https://pub.dartlang.org"
6565
source: hosted
66-
version: "1.2.0"
66+
version: "1.3.0"
6767
flutter:
6868
dependency: "direct main"
6969
description: flutter
@@ -81,6 +81,13 @@ packages:
8181
url: "https://pub.dartlang.org"
8282
source: hosted
8383
version: "0.12.11"
84+
material_color_utilities:
85+
dependency: transitive
86+
description:
87+
name: material_color_utilities
88+
url: "https://pub.dartlang.org"
89+
source: hosted
90+
version: "0.1.4"
8491
meta:
8592
dependency: transitive
8693
description:
@@ -94,7 +101,7 @@ packages:
94101
name: path
95102
url: "https://pub.dartlang.org"
96103
source: hosted
97-
version: "1.8.0"
104+
version: "1.8.1"
98105
pedantic:
99106
dependency: "direct dev"
100107
description:
@@ -113,7 +120,7 @@ packages:
113120
name: source_span
114121
url: "https://pub.dartlang.org"
115122
source: hosted
116-
version: "1.8.1"
123+
version: "1.8.2"
117124
stack_trace:
118125
dependency: transitive
119126
description:
@@ -148,21 +155,14 @@ packages:
148155
name: test_api
149156
url: "https://pub.dartlang.org"
150157
source: hosted
151-
version: "0.4.3"
152-
typed_data:
153-
dependency: transitive
154-
description:
155-
name: typed_data
156-
url: "https://pub.dartlang.org"
157-
source: hosted
158-
version: "1.3.0"
158+
version: "0.4.9"
159159
vector_math:
160160
dependency: transitive
161161
description:
162162
name: vector_math
163163
url: "https://pub.dartlang.org"
164164
source: hosted
165-
version: "2.1.1"
165+
version: "2.1.2"
166166
sdks:
167-
dart: ">=2.14.0 <3.0.0"
167+
dart: ">=2.17.1 <3.0.0"
168168
flutter: ">=2.0.0"

pubspec.lock

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -14,12 +14,19 @@ packages:
1414
name: collection
1515
url: "https://pub.dartlang.org"
1616
source: hosted
17-
version: "1.15.0"
17+
version: "1.16.0"
1818
flutter:
1919
dependency: "direct main"
2020
description: flutter
2121
source: sdk
2222
version: "0.0.0"
23+
material_color_utilities:
24+
dependency: transitive
25+
description:
26+
name: material_color_utilities
27+
url: "https://pub.dartlang.org"
28+
source: hosted
29+
version: "0.1.4"
2330
meta:
2431
dependency: transitive
2532
description:
@@ -39,20 +46,13 @@ packages:
3946
description: flutter
4047
source: sdk
4148
version: "0.0.99"
42-
typed_data:
43-
dependency: transitive
44-
description:
45-
name: typed_data
46-
url: "https://pub.dartlang.org"
47-
source: hosted
48-
version: "1.3.0"
4949
vector_math:
5050
dependency: transitive
5151
description:
5252
name: vector_math
5353
url: "https://pub.dartlang.org"
5454
source: hosted
55-
version: "2.1.1"
55+
version: "2.1.2"
5656
sdks:
57-
dart: ">=2.14.0 <3.0.0"
57+
dart: ">=2.17.1 <3.0.0"
5858
flutter: ">=2.0.0"

pubspec.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ version: 2.0.0
44
homepage: https://github.com/kmcgill88/admob_flutter
55

66
environment:
7-
sdk: '>=2.12.0 <3.0.0'
7+
sdk: ">=2.17.1 <3.0.0"
88
flutter: ">=2.0.0"
99

1010
dependencies:

0 commit comments

Comments
 (0)