Last active
November 6, 2019 02:37
-
-
Save dev-chee/cea744e671fec25df6ac005db6c70d1d to your computer and use it in GitHub Desktop.
unity build script for android
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| buildscript { | |
| repositories { | |
| google() | |
| jcenter() | |
| maven { | |
| url 'https://maven.google.com' | |
| name 'Google' | |
| } | |
| } | |
| dependencies { | |
| classpath 'com.android.tools.build:gradle:3.2.0' | |
| } | |
| } | |
| allprojects { | |
| repositories { | |
| google() | |
| jcenter() | |
| maven { | |
| url 'https://maven.google.com' | |
| } | |
| maven { | |
| url "https://jitpack.io" | |
| } | |
| flatDir { | |
| dirs 'libs' | |
| } | |
| } | |
| } | |
| apply plugin: 'com.android.application' | |
| dependencies { | |
| implementation fileTree(dir: 'libs', include: ['*.jar', '*.aar']) | |
| implementation 'com.android.support:multidex:1.0.3' | |
| implementation project(':GoogleMobileAdsAppLovinMediation') | |
| implementation project(':GoogleMobileAdsIronSourceMediation') | |
| implementation project(':GoogleMobileAdsOtherMediation') | |
| implementation project(':GoogleMobileAdsPlugin') | |
| implementation project(':localizedappnamelib') | |
| } | |
| android { | |
| compileSdkVersion **APIVERSION** | |
| buildToolsVersion '**BUILDTOOLS**' | |
| signingConfigs { | |
| release { | |
| storeFile file('keystore/rd1.jks') | |
| storePassword '123456' | |
| keyAlias 'test' | |
| keyPassword '123456' | |
| } | |
| } | |
| defaultConfig { | |
| minSdkVersion **MINSDKVERSION** | |
| targetSdkVersion **TARGETSDKVERSION** | |
| applicationId '**APPLICATIONID**' | |
| versionCode **VERSIONCODE** | |
| versionName '**VERSIONNAME**' | |
| } | |
| lintOptions { | |
| abortOnError false | |
| //disable 'MissingTranslation' | |
| //checkReleaseBuilds false | |
| } | |
| dexOptions { | |
| javaMaxHeapSize "4g" | |
| additionalParameters = ['--multi-dex', '--set-max-idx-number=48000'] | |
| } | |
| aaptOptions { | |
| noCompress '.unity3d', '.ress', '.resource', '.obb'**STREAMING_ASSETS** | |
| } | |
| buildTypes { | |
| debug { | |
| signingConfig signingConfigs.debug | |
| multiDexEnabled true | |
| multiDexKeepProguard file('multidex-config.txt') | |
| minifyEnabled **MINIFY_DEBUG** | |
| shrinkResources false | |
| useProguard **PROGUARD_DEBUG** | |
| proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-unity.txt'**USER_PROGUARD** | |
| jniDebuggable true | |
| } | |
| release { | |
| signingConfig signingConfigs.release | |
| multiDexEnabled true | |
| multiDexKeepProguard file('multidex-config.txt') | |
| minifyEnabled **MINIFY_RELEASE** | |
| shrinkResources false | |
| useProguard **PROGUARD_RELEASE** | |
| proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-unity.txt'**USER_PROGUARD** | |
| //proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-unity.txt'**USER_PROGUARD** | |
| } | |
| } | |
| splits { | |
| density { | |
| enable false | |
| } | |
| abi { | |
| enable true | |
| reset() | |
| include **ABIFILTERS** | |
| universalApk false | |
| } | |
| } | |
| sourceSets { | |
| main { | |
| jniLibs.srcDir 'jniLibs' | |
| } | |
| } | |
| } | |
| ext.abiCodes = ['armeabi-v7a': 1, 'arm64-v8a': 3, x86: 5] | |
| import com.android.build.OutputFile | |
| android.applicationVariants.all { variant -> | |
| variant.outputs.all { output -> | |
| def baseAbiVersionCode = abiCodes.get(output.getFilter(OutputFile.ABI)) | |
| if (baseAbiVersionCode != null) { | |
| output.versionCodeOverride = baseAbiVersionCode * 100000 + variant.versionCode | |
| } | |
| output.outputFileName = output.outputFileName.replace(".apk", "-${variant.versionName}.apk") | |
| } | |
| } | |
| **SOURCE_BUILD_SETUP** |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment