Android Setup(deprecated)

Setting up gradle

baseProjectTemplate.gradle :

//Unity 2019.4 or prev
allprojects {
    buildscript {
        ...
        }

        dependencies {            
            classpath 'com.android.tools.build:gradle:3.4.3'
            classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:1.3.11"
            **BUILD_SCRIPT_DEPS**
        }
    }
}
//Unity 2020.3 or higher
allprojects {
    buildscript {
        ...
        }

        dependencies {            
            classpath 'com.android.tools.build:gradle:4.0.1'
            classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:1.3.61"
            **BUILD_SCRIPT_DEPS**
        }
    }
}
//Unity 2022.3 higher
plugins {
    id 'com.android.application' version '7.1.2' apply false
    id 'com.android.library' version '7.1.2' apply false
    id 'org.jetbrains.kotlin.android' version '1.3.72' apply false
    **BUILD_SCRIPT_DEPS**
}

mainTemplate.gradle :

Resolver usage

For resolver users, please refer to UniversalSDKDependencies.xml

Apply social id to project

Please edit your Assets/Plugins/Android/launcherTemplate.gradle Activate the checkbox to create a file.

check-gradle

Insert the line resValue. If you are not sure, please refer to the Demo.

launcherTemplate.gradle :

AndroidX Use

gradleTemplate.properties :

Proguard settings

  • Obfuscating with Proguard when building

  • Project Settings > Player > Publishing Settings > Minify R8 enabled

If you're using Proguard, add the following to the proguard-user.txt file.

Last updated