mainTemplate.gradle

作者:追风剑情 发布于:2019-11-19 16:40 分类:Unity3d

可以访问 https://developer.aliyun.com/mvn/view 来查看阿里云提供的所有镜像仓库地址。
[Unity手册] android-gradle-overview

删除 // Android Resolver xxx Start// Android Resolver xxx End注释,否则Unity会对mainTemplate.gradle文件进行重新生成,这将覆盖我们的修改。

// GENERATED BY UNITY. REMOVE THIS COMMENT TO PREVENT OVERWRITING WHEN EXPORTING AGAIN

buildscript {
    repositories {
        //优先从阿里云镜像下载
        maven{ url 'https://maven.aliyun.com/repository/public/' }
        maven{ url 'https://maven.aliyun.com/repository/central' }
        maven{ url 'https://maven.aliyun.com/repository/google' }
        //华为云镜像下载
        maven { url 'https://repo.huaweicloud.com/repository/maven' }
        //JitPack仓库下载
        maven { url 'https://jitpack.io' }
        mavenCentral()
        google()
        jcenter()
    }

    dependencies {
        //gradle插件版本
        classpath 'com.android.tools.build:gradle:3.4.0'
**BUILD_SCRIPT_DEPS**}
}

allprojects {
    repositories {
        //优先从阿里云镜像下载
        maven{ url 'http://maven.aliyun.com/nexus/content/groups/public/' }
        maven{ url 'https://maven.aliyun.com/repository/google' }
        //华为云镜像下载
        maven { url 'https://repo.huaweicloud.com/repository/maven' }
        //JitPack仓库下载
        maven { url 'https://jitpack.io' }
        mavenCentral()
        google()
        jcenter()
        flatDir {
            dirs 'libs'
        }
    }
}

apply plugin: 'com.android.application'
**APPLY_PLUGINS**

dependencies {
    implementation fileTree(dir: 'libs', include: ['*.jar'])
**DEPS**}

android {
    compileSdkVersion **APIVERSION**
    buildToolsVersion '**BUILDTOOLS**'

    compileOptions {
        sourceCompatibility JavaVersion.VERSION_1_8
        targetCompatibility JavaVersion.VERSION_1_8
    }

    defaultConfig {
        minSdkVersion **MINSDKVERSION**
        targetSdkVersion **TARGETSDKVERSION**
        applicationId 'com.deltalpha.ipadapp'
        ndk {
            abiFilters **ABIFILTERS**
        }
        versionCode 1
        versionName '1.0.0'
    }

    lintOptions {
        abortOnError false
    }

    aaptOptions {
        noCompress = ['.unity3d', '.ress', '.resource', '.obb'**STREAMING_ASSETS**]
    }**SIGN**
	
	//必须在buildTypes之前声明
	signingConfigs {
		debug {
			keyAlias "deltalpha"
			keyPassword "123456"
			storePassword "123456"
			//keystore文件与Assets处于同级目录时
			storeFile rootProject.file("../../user.keystore")
		}
		release {
			keyAlias "deltalpha"
			keyPassword "123456"
			storePassword "123456"
			//keystore文件与Assets处于同级目录时
			storeFile rootProject.file("../../user.keystore")
		}
	}

    buildTypes {
        debug {
            minifyEnabled **MINIFY_DEBUG**
            useProguard **PROGUARD_DEBUG**
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-unity.txt'**USER_PROGUARD**
            jniDebuggable true
			//使用签名配置
			signingConfig signingConfigs.debug
        }
        release {
            //关闭混淆
            minifyEnabled false
            useProguard **PROGUARD_RELEASE**
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-unity.txt'**USER_PROGUARD****SIGNCONFIG**
			//使用签名配置
			signingConfig signingConfigs.release
		}
    }**PACKAGING_OPTIONS****SPLITS**
**BUILT_APK_LOCATION**
    bundle {
        language {
            enableSplit = false
        }
        density {
            enableSplit = false
        }
        abi {
            enableSplit = true
        }
    }
}**SPLITS_VERSION_CODE****REPOSITORIES****SOURCE_BUILD_SETUP**

标签: Unity3d

Powered by emlog  蜀ICP备18021003号-1   sitemap

川公网安备 51019002001593号