Unity骚操作:更改u3d导出apk时候所使用的 gradle、GradleTemplates、VisualStudioGradleTemplates、minifyEnabled是否开启混淆等

测试unity版本:5.6.4

Unity骚操作:更改u3d导出apk时候所使用的 gradle、GradleTemplates、VisualStudioGradleTemplates、minifyEnabled是否开启混淆等_第1张图片

gradle文件夹:里面的是一些unity用自身打包apk时候用到的一些工具

GradleTemplates文件夹:

   libTemplate.gradle 

buildscript {
	repositories {
		mavenCentral()
	}
	dependencies {
		classpath 'com.android.tools.build:gradle:2.1.0'
	}
}

apply plugin: 'android-library'

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

android {
	sourceSets {
		main {
			manifest.srcFile 'AndroidManifest.xml'
			//java.srcDirs = ['src']
			res.srcDirs = ['res']
			assets.srcDirs = ['assets']
			jniLibs.srcDirs = ['libs']
		}
	}

	compileSdkVersion **APIVERSION**
	buildToolsVersion '**BUILDTOOLS**'
	defaultConfig {
		targetSdkVersion **LIBSDKTARGET**
	}

	lintOptions {
		abortOnError false
	}
}

mainTemplate.gradle

// GENERATED BY UNITY. REMOVE THIS COMMENT TO PREVENT OVERWRITING WHEN EXPORTING AGAIN
buildscript {
	repositories {
		jcenter()
	}

	dependencies {
		classpath 'com.android.tools.build:gradle:2.1.0'
	}
}

allprojects {
   repositories {
      flatDir {
        dirs 'libs'
      }
   }
}

apply plugin: 'com.android.application'

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

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

	defaultConfig {
		targetSdkVersion **TARGETSDKVERSION**
		applicationId '**APPLICATIONID**'
	}

	lintOptions {
		abortOnError false
	}

	aaptOptions {
		noCompress '.unity3d', '.ress', '.resource', '.obb'
	}

**SIGN**
	buildTypes {
		debug {
			jniDebuggable true
		}
		release {
			// Set minifyEnabled to true if you want to run ProGuard on your project
			minifyEnabled false //是否开启混淆
			proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-unity.txt'
			**SIGNCONFIG**
		}
	}

}

 settingsTemplate.gradle

**INCLUDES**

附上让Unity自身打APK的时候 使用上镜像并且设置上 build:gradle通用工具让 需要生成AS工程的时候 可以让AS识别

// Top-level build file where you can add configuration options common to all sub-projects/modules.

buildscript {
    repositories {
      //阿里云镜像
        maven {
            allowInsecureProtocol true
            url 'https://maven.aliyun.com/nexus/content/repositories/google' }
        maven {
            allowInsecureProtocol  true
            url 'https://maven.aliyun.com/nexus/content/groups/public/' }
        maven {
            allowInsecureProtocol  true
            url 'https://maven.aliyun.com/nexus/content/repositories/jcenter'}
        mavenCentral()
        google()
        
    }
    dependencies {
        classpath 'com.android.tools.build:gradle:3.6.0' //为了让u3d打出AS工程的时候和AS安装程序所支持的build.gradle一致
        
        // NOTE: Do not place your application dependencies here; they belong
        // in the individual module build.gradle files
    }
}

allprojects {
    repositories {
        //阿里云镜像
        maven {
            allowInsecureProtocol true
            url 'https://maven.aliyun.com/nexus/content/repositories/google' }
        maven {
            allowInsecureProtocol  true
            url 'https://maven.aliyun.com/nexus/content/groups/public/' }
        maven {
            allowInsecureProtocol  true
            url 'https://maven.aliyun.com/nexus/content/repositories/jcenter'}
        mavenCentral()
        google()
        
    }
}

task clean(type: Delete) {
    delete rootProject.buildDir
}

你可能感兴趣的:(Unity,安卓,unity,游戏引擎)