-
Notifications
You must be signed in to change notification settings - Fork 3.4k
[interactive_media_ads] Updates README
with information about enabling desugaring on Android
#9790
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from 1 commit
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change | ||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
@@ -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`. | ||||||||||||||
|
||||||||||||||
<?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 | |||||||||||||
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE"/> | ||||||||||||||
``` | ||||||||||||||
|
||||||||||||||
#### 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). | ||||||||||||||
Comment on lines
+60
to
+62
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The link to the Android developer documentation is broken, and the specified dependency version for
I've suggested updating both the dependency and the link.
Suggested change
|
||||||||||||||
|
||||||||||||||
<?code-excerpt "example/android/app/build.gradle (android_desugaring)"?> | ||||||||||||||
```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 | ||||||||||||||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -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' | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. |
||
// #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 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There is a typo in the changelog entry.
desugarging
should bedesugaring
.