Skip to content

Commit 01d4c31

Browse files
[interactive_media_ads] Updates README with information about enabling desugaring on Android (#9790)
Get started for IMA on Android includes enabling desugaring: https://developers.google.com/interactive-media-ads/docs/sdks/android/client-side/get-started#2.-add-the-ima-sdk-to-your-project This updates the README for the plugin with the same information. ## Pre-Review Checklist **Note**: The Flutter team is currently trialing the use of [Gemini Code Assist for GitHub](https://developers.google.com/gemini-code-assist/docs/review-github-code). Comments from the `gemini-code-assist` bot should not be taken as authoritative feedback from the Flutter team. If you find its comments useful you can update your code accordingly, but if you are unsure or disagree with the feedback, please feel free to wait for a Flutter team member's review for guidance on which automated comments should be addressed. [^1]: Regular contributors who have demonstrated familiarity with the repository guidelines only need to comment if the PR is not auto-exempted by repo tooling.
1 parent 9cf3844 commit 01d4c31

File tree

6 files changed

+52
-7
lines changed

6 files changed

+52
-7
lines changed

packages/interactive_media_ads/CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
## 0.2.6+3
2+
3+
* Updates `README` with information about enabling desugaring on Android.
4+
15
## 0.2.6+2
26

37
* Updates kotlin version to 2.2.0 to enable gradle 8.11 support.

packages/interactive_media_ads/README.md

Lines changed: 33 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,7 @@ a separate video player positioned on top of the app's content video player.
1414
| **Support** | SDK 21+ | 12.0+ |
1515

1616
**NOTE:**
17-
* Companion ads, Background Audio ads and Google Dynamic Ad Insertion methods are currently not
18-
supported.
17+
* Background Audio ads and Google Dynamic Ad Insertion methods are currently not supported.
1918

2019
## IMA client-side overview
2120

@@ -37,9 +36,13 @@ initialization and playback.
3736
This guide demonstrates how to integrate the IMA SDK into a new `Widget` using the [video_player][7]
3837
plugin to display content.
3938

40-
### 1. Add Android Required Permissions
39+
### 1. Update Android App
4140

42-
If building on Android, add the user permissions required by the IMA SDK for requesting ads in
41+
If not building for Android, skip this step.
42+
43+
#### Update Android Manifest
44+
45+
Add the user permissions required by the IMA SDK for requesting ads in
4346
`android/app/src/main/AndroidManifest.xml`.
4447

4548
<?code-excerpt "example/android/app/src/main/AndroidManifest.xml (android_manifest)"?>
@@ -50,6 +53,32 @@ If building on Android, add the user permissions required by the IMA SDK for req
5053
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE"/>
5154
```
5255

56+
#### Update Android App-level Gradle
57+
58+
The IMA SDK requires library desugaring enabled, which you must do by setting
59+
`coreLibraryDesugaringEnabled true` and adding
60+
`coreLibraryDesugaring 'com.android.tools:desugar_jdk_libs:2.1.5'` as a dependency in the
61+
`android/app/build.gradle` file. For more details, see
62+
[Java 11+ APIs available through desugaring with the nio specification](https://developer.android.com/studio/write/java11-nio-support-table).
63+
64+
<?code-excerpt "example/android/app/build.gradle (android_desugaring)"?>
65+
```groovy
66+
android {
67+
// ···
68+
compileOptions {
69+
coreLibraryDesugaringEnabled true
70+
sourceCompatibility JavaVersion.VERSION_11
71+
targetCompatibility JavaVersion.VERSION_11
72+
}
73+
// ···
74+
}
75+
// ···
76+
dependencies {
77+
coreLibraryDesugaring 'com.android.tools:desugar_jdk_libs:2.1.5'
78+
// ···
79+
}
80+
```
81+
5382
### 2. Add Imports
5483

5584
Add the import statements for the `interactive_media_ads` and [video_player][7]. Both plugins should

packages/interactive_media_ads/android/src/main/kotlin/dev/flutter/packages/interactive_media_ads/AdsRequestProxyApi.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ class AdsRequestProxyApi(override val pigeonRegistrar: ProxyApiRegistrar) :
2121
*
2222
* This must match the version in pubspec.yaml.
2323
*/
24-
const val pluginVersion = "0.2.6+2"
24+
const val pluginVersion = "0.2.6+3"
2525
}
2626

2727
override fun setAdTagUrl(pigeon_instance: AdsRequest, adTagUrl: String) {

packages/interactive_media_ads/example/android/app/build.gradle

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,15 +22,20 @@ if (flutterVersionName == null) {
2222
flutterVersionName = '1.0'
2323
}
2424

25+
// #docregion android_desugaring
2526
android {
27+
// #enddocregion android_desugaring
2628
namespace "dev.flutter.packages.interactive_media_ads_example"
2729
compileSdk = flutter.compileSdkVersion
2830
ndkVersion = flutter.ndkVersion
2931

32+
// #docregion android_desugaring
3033
compileOptions {
34+
coreLibraryDesugaringEnabled true
3135
sourceCompatibility JavaVersion.VERSION_11
3236
targetCompatibility JavaVersion.VERSION_11
3337
}
38+
// #enddocregion android_desugaring
3439

3540
kotlinOptions {
3641
jvmTarget = '11'
@@ -54,15 +59,22 @@ android {
5459
signingConfig signingConfigs.debug
5560
}
5661
}
62+
// #docregion android_desugaring
5763
}
64+
// #enddocregion android_desugaring
5865

5966
flutter {
6067
source '../..'
6168
}
6269

70+
// #docregion android_desugaring
6371
dependencies {
72+
coreLibraryDesugaring 'com.android.tools:desugar_jdk_libs:2.1.5'
73+
// #enddocregion android_desugaring
6474
testImplementation 'junit:junit:4.13.2'
6575
androidTestImplementation 'androidx.test:runner:1.2.0'
6676
androidTestImplementation 'androidx.test.espresso:espresso-core:3.2.0'
6777
api 'androidx.test:core:1.4.0'
78+
// #docregion android_desugaring
6879
}
80+
// #enddocregion android_desugaring

packages/interactive_media_ads/ios/interactive_media_ads/Sources/interactive_media_ads/AdsRequestProxyAPIDelegate.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ class AdsRequestProxyAPIDelegate: PigeonApiDelegateIMAAdsRequest {
1313
/// The current version of the `interactive_media_ads` plugin.
1414
///
1515
/// This must match the version in pubspec.yaml.
16-
static let pluginVersion = "0.2.6+2"
16+
static let pluginVersion = "0.2.6+3"
1717

1818
func pigeonDefaultConstructor(
1919
pigeonApi: PigeonApiIMAAdsRequest, adTagUrl: String, adDisplayContainer: IMAAdDisplayContainer,

packages/interactive_media_ads/pubspec.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ name: interactive_media_ads
22
description: A Flutter plugin for using the Interactive Media Ads SDKs on Android and iOS.
33
repository: https://github.com/flutter/packages/tree/main/packages/interactive_media_ads
44
issue_tracker: https://github.com/flutter/flutter/issues?q=is%3Aissue+is%3Aopen+label%3A%22p%3A+interactive_media_ads%22
5-
version: 0.2.6+2 # This must match the version in
5+
version: 0.2.6+3 # This must match the version in
66
# `android/src/main/kotlin/dev/flutter/packages/interactive_media_ads/AdsRequestProxyApi.kt` and
77
# `ios/interactive_media_ads/Sources/interactive_media_ads/AdsRequestProxyAPIDelegate.swift`
88

0 commit comments

Comments
 (0)