-
Notifications
You must be signed in to change notification settings - Fork 4
Include Android
The Clever Ads Solutions Unity plugin is distributed with the EDM4U library. This library is intended for use by any Unity plugin that requires access to Android specific libraries (e.g., AARs) or iOS CocoaPods. It provides Unity plugins the ability to declare dependencies, which are then automatically resolved and copied into your Unity project.
Using EDM4U, you will be able to avoid downloading the Android artifacts into your project. Instead, the artifacts will be added to your gradle file during the compilation. To enable this process, follow these steps:
- Go to:
Player Settings > Publishing Settings > Build
-
Custom Main Gradle Template
to configure third party dependencies. -
Custom Base Gradle Template
to update Gradle plugin with fix support Android 11.
You can read more about fix Gradle plugin with support Android 11 on the Android Deleveloper page. -
Custom Gradle Properties Template
to use Jetfier by EDM4U. -
Custom Main Manifest
to modify application manifest. -
Custom Gradle Settings Template
to include maven repositories
Support Android Gradle Plugin version 7.1.0+
- Go to:
Assets > External Dependency Manager > Android > Settings
-
Patch mainTemplate.gradle
The mainTemplate.gradle file will be patched with dependencies managed by the Android Resolver. - Save your changes, by pressing
OK
In the Unity editor, select Assets > External Dependency Manager > Android Resolver > Resolve
. The Unity External Dependency Manager library will append dependencies to mainTemplate.gradle
of your Unity app.
Advertising events for the Android runtime are queued to be called during the next Update()
cycle. This behavior is safe for using UnityEngine components in advertising events. However, because Unity does not call Update
while displaying fullscreen ads, all ad events will only be triggered after closing the fullscreen ad and returning to the Unity game.
If you want to receive callbacks from the ad without waiting for the ad to close, you can disable the isExecuteEventsOnUnityThread
property in the settings. Enabled by default.
CAS.MobileAds.settings.isExecuteEventsOnUnityThread = false;
You will also need to use CAS.EventExecutor.Add(Action)
to access Unity Engine components, where Action will be executed during the next Update()
cycle.
Note
isExecuteEventsOnUnityThread property used Android runtime only and enabled by default.
CAS have option to override Gradle Wrapper and Android Gradle Plugin versions in CAS Other Settings. The specified versions will be pre-set for the Android Studio project without requiring manual project export.
Leave the fields empty to use unity original Gradle versions.
Supported strings with full https url or just version number, for example 7.2
or full url:
https\://services.gradle.org/distributions/gradle-7.2-bin.zip
Supported version strings only, for example 4.2.2
.
Note
Please ensure compatibility of all build components when using this option. See official Gradle and Android Gradle Plugin compatibility table here
🔗 Done! What’s Next?
- Read about compliance with the Google Plays Families Policy
- Make sure you are Include iOS platform as well.
- Project Setup
- Configuring SDK
- Include Android
- Include iOS
- Additional mediation steps
- App-ads.txt🔗