diff --git a/packages/interactive_media_ads/CHANGELOG.md b/packages/interactive_media_ads/CHANGELOG.md index 7a4e068c4a0..33c278b7eaf 100644 --- a/packages/interactive_media_ads/CHANGELOG.md +++ b/packages/interactive_media_ads/CHANGELOG.md @@ -1,3 +1,7 @@ +## 0.2.6+3 + +* Updates `README` with information about enabling desugaring on Android. + ## 0.2.6+2 * Updates kotlin version to 2.2.0 to enable gradle 8.11 support. diff --git a/packages/interactive_media_ads/README.md b/packages/interactive_media_ads/README.md index b80b5a10d5f..9b4a6db237b 100644 --- a/packages/interactive_media_ads/README.md +++ b/packages/interactive_media_ads/README.md @@ -14,8 +14,7 @@ a separate video player positioned on top of the app's content video player. | **Support** | SDK 21+ | 12.0+ | **NOTE:** -* Companion ads, Background Audio ads and Google Dynamic Ad Insertion methods are currently not - supported. +* Background Audio ads and Google Dynamic Ad Insertion methods are currently not supported. ## IMA client-side overview @@ -37,9 +36,13 @@ initialization and playback. This guide demonstrates how to integrate the IMA SDK into a new `Widget` using the [video_player][7] plugin to display content. -### 1. Add Android Required Permissions +### 1. Update Android App -If building on Android, add the user permissions required by the IMA SDK for requesting ads in +If not building for Android, skip this step. + +#### Update Android Manifest + +Add the user permissions required by the IMA SDK for requesting ads in `android/app/src/main/AndroidManifest.xml`. @@ -50,6 +53,32 @@ If building on Android, add the user permissions required by the IMA SDK for req ``` +#### Update Android App-level Gradle + +The IMA SDK requires library desugaring enabled, which you must do by setting +`coreLibraryDesugaringEnabled true` and adding +`coreLibraryDesugaring 'com.android.tools:desugar_jdk_libs:2.1.5'` as a dependency in the +`android/app/build.gradle` file. For more details, see +[Java 11+ APIs available through desugaring with the nio specification](https://developer.android.com/studio/write/java11-nio-support-table). + + +```groovy +android { +// ··· + compileOptions { + coreLibraryDesugaringEnabled true + sourceCompatibility JavaVersion.VERSION_11 + targetCompatibility JavaVersion.VERSION_11 + } + // ··· +} +// ··· +dependencies { + coreLibraryDesugaring 'com.android.tools:desugar_jdk_libs:2.1.5' + // ··· +} +``` + ### 2. Add Imports Add the import statements for the `interactive_media_ads` and [video_player][7]. Both plugins should diff --git a/packages/interactive_media_ads/android/src/main/kotlin/dev/flutter/packages/interactive_media_ads/AdsRequestProxyApi.kt b/packages/interactive_media_ads/android/src/main/kotlin/dev/flutter/packages/interactive_media_ads/AdsRequestProxyApi.kt index d5928fe1a48..8b48a5a2db4 100644 --- a/packages/interactive_media_ads/android/src/main/kotlin/dev/flutter/packages/interactive_media_ads/AdsRequestProxyApi.kt +++ b/packages/interactive_media_ads/android/src/main/kotlin/dev/flutter/packages/interactive_media_ads/AdsRequestProxyApi.kt @@ -21,7 +21,7 @@ class AdsRequestProxyApi(override val pigeonRegistrar: ProxyApiRegistrar) : * * This must match the version in pubspec.yaml. */ - const val pluginVersion = "0.2.6+2" + const val pluginVersion = "0.2.6+3" } override fun setAdTagUrl(pigeon_instance: AdsRequest, adTagUrl: String) { diff --git a/packages/interactive_media_ads/example/android/app/build.gradle b/packages/interactive_media_ads/example/android/app/build.gradle index dfc0d95664b..1ea76f564af 100644 --- a/packages/interactive_media_ads/example/android/app/build.gradle +++ b/packages/interactive_media_ads/example/android/app/build.gradle @@ -22,15 +22,20 @@ if (flutterVersionName == null) { flutterVersionName = '1.0' } +// #docregion android_desugaring android { +// #enddocregion android_desugaring namespace "dev.flutter.packages.interactive_media_ads_example" compileSdk = flutter.compileSdkVersion ndkVersion = flutter.ndkVersion + // #docregion android_desugaring compileOptions { + coreLibraryDesugaringEnabled true sourceCompatibility JavaVersion.VERSION_11 targetCompatibility JavaVersion.VERSION_11 } + // #enddocregion android_desugaring kotlinOptions { jvmTarget = '11' @@ -54,15 +59,22 @@ android { signingConfig signingConfigs.debug } } +// #docregion android_desugaring } +// #enddocregion android_desugaring flutter { source '../..' } +// #docregion android_desugaring dependencies { + coreLibraryDesugaring 'com.android.tools:desugar_jdk_libs:2.1.5' + // #enddocregion android_desugaring testImplementation 'junit:junit:4.13.2' androidTestImplementation 'androidx.test:runner:1.2.0' androidTestImplementation 'androidx.test.espresso:espresso-core:3.2.0' api 'androidx.test:core:1.4.0' +// #docregion android_desugaring } +// #enddocregion android_desugaring diff --git a/packages/interactive_media_ads/ios/interactive_media_ads/Sources/interactive_media_ads/AdsRequestProxyAPIDelegate.swift b/packages/interactive_media_ads/ios/interactive_media_ads/Sources/interactive_media_ads/AdsRequestProxyAPIDelegate.swift index d98862c976d..baf2bcab164 100644 --- a/packages/interactive_media_ads/ios/interactive_media_ads/Sources/interactive_media_ads/AdsRequestProxyAPIDelegate.swift +++ b/packages/interactive_media_ads/ios/interactive_media_ads/Sources/interactive_media_ads/AdsRequestProxyAPIDelegate.swift @@ -13,7 +13,7 @@ class AdsRequestProxyAPIDelegate: PigeonApiDelegateIMAAdsRequest { /// The current version of the `interactive_media_ads` plugin. /// /// This must match the version in pubspec.yaml. - static let pluginVersion = "0.2.6+2" + static let pluginVersion = "0.2.6+3" func pigeonDefaultConstructor( pigeonApi: PigeonApiIMAAdsRequest, adTagUrl: String, adDisplayContainer: IMAAdDisplayContainer, diff --git a/packages/interactive_media_ads/pubspec.yaml b/packages/interactive_media_ads/pubspec.yaml index 1b88ae73fed..376d105b1bf 100644 --- a/packages/interactive_media_ads/pubspec.yaml +++ b/packages/interactive_media_ads/pubspec.yaml @@ -2,7 +2,7 @@ name: interactive_media_ads description: A Flutter plugin for using the Interactive Media Ads SDKs on Android and iOS. repository: https://github.com/flutter/packages/tree/main/packages/interactive_media_ads issue_tracker: https://github.com/flutter/flutter/issues?q=is%3Aissue+is%3Aopen+label%3A%22p%3A+interactive_media_ads%22 -version: 0.2.6+2 # This must match the version in +version: 0.2.6+3 # This must match the version in # `android/src/main/kotlin/dev/flutter/packages/interactive_media_ads/AdsRequestProxyApi.kt` and # `ios/interactive_media_ads/Sources/interactive_media_ads/AdsRequestProxyAPIDelegate.swift`