Unity 2019.3.X Potential Issue

Resolve building issues with some Unity 2019.3.X versions

If there is mainTemplate.gradle file in your project and you use Unity 2019.3.X there might be building errors like:

java.lang.RuntimeException: Duplicate class android.support.customtabs.ICustomTabsCallback found in modules classes.jar (androidx.browser:browser:1.0.0) and classes.jar (com.android.support:customtabs:26.1.0)

UnityEngine.GUIUtility:ProcessEvent(Int32, IntPtr) (at /Users/builduser/buildslave/unity/build/Modules/IMGUI/GUIUtility.cs:187)

To resolve it, please create settingsTemplate.gradle in project’s Assets/Plugins/Android directory. Add this code to the new file:

gradle.rootProject {
    it.afterEvaluate {
        it.allprojects {
            // Since Unity 2019.3 enabling Jetifier via mainTemplate.gradle is no longer working
            it.ext['android.useAndroidX'] = true
            it.ext['android.enableJetifier'] = true
        }
    }
}

include ':launcher', ':unityLibrary'
**INCLUDES**

Last updated