-
Notifications
You must be signed in to change notification settings - Fork 4
Include Android
⚡ Before you start
Make sure you have correctly setup project settings.
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 Launcher Gradle Template
to enable MultiDEX.
You can read more about MuliDex on the Android Deleveloper page. -
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.
- 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. -
Use Jetfier
Legacy Android support libraries and references to them from other libraries will be rewritten to use Jetpack using the Jetifier tool. -
Patch gradleTemplate.properties
For Unity 2019.3 and above, it is recommended to enable Jetfier and AndroidX via gradleTemplate.properties. This has no effect in older versions of Unity. - 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.
At times, including the CAS SDK may cause the 64K limit on methods that can be packaged in an Android dex file to be breached. This can happen if, for example, your app packs a lot of features for your users and includes substantive code to realize this.
If you would like to enable the MultiDEX support library, you can do so in the Assets > CleverAdsSolutions > Android Settings
by following these instructions:
- MultiDEX enabled
You can read more about MultiDex on the Android Deleveloper page.
Gradle is a build system that automates a number of build processes and prevents many common build errors.
The Unity Android build system is based on Gradle, and the Android Gradle plugin adds several features that are specific to building Android apps.
The CAS Unity plugin automatically determines the optimal Gradle plugin version depending on the selected version of the Gradle Wrapper in Unity->Preferences->External Tools
menu.
You have the option to disable automatic Update Gradle Plugin
in Assets > CleverAdsSlutions > Android Settings
.
Although the Android Gradle Wrapper is typically updated in lock-step with Unity version, the wrapper can run independent of Unity and be updated separately:
- Download Gradle wrapper 6.5.1
- Unzip the archive to any location.
- Go to
Unity->Preferences->External Tools
menu. - Deselect option:
- Gadle Installed with Unity(recommended)
- Select a path to a
.../gradle-6.5.1
you have downloaded manually. - The CAS Unity plugin will do the rest of the configuration automatically.
What’s Next?
- Preparing Mediated Networks
- Make sure you are Include iOS platform as well.
- Verify your integration
- Project Setup
- Configuring SDK
- Include Android
- Include iOS
- Additional mediation steps
- App-ads.txt🔗