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文件进行重新生成,这将覆盖我们的修改。

  1. // GENERATED BY UNITY. REMOVE THIS COMMENT TO PREVENT OVERWRITING WHEN EXPORTING AGAIN
  2.  
  3. buildscript {
  4. repositories {
  5. //优先从阿里云镜像下载
  6. maven{ url 'https://maven.aliyun.com/repository/public/' }
  7. maven{ url 'https://maven.aliyun.com/repository/central' }
  8. maven{ url 'https://maven.aliyun.com/repository/google' }
  9. //华为云镜像下载
  10. maven { url 'https://repo.huaweicloud.com/repository/maven' }
  11. //JitPack仓库下载
  12. maven { url 'https://jitpack.io' }
  13. mavenCentral()
  14. google()
  15. jcenter()
  16. }
  17.  
  18. dependencies {
  19. //gradle插件版本
  20. classpath 'com.android.tools.build:gradle:3.4.0'
  21. **BUILD_SCRIPT_DEPS**}
  22. }
  23.  
  24. allprojects {
  25. repositories {
  26. //优先从阿里云镜像下载
  27. maven{ url 'http://maven.aliyun.com/nexus/content/groups/public/' }
  28. maven{ url 'https://maven.aliyun.com/repository/google' }
  29. //华为云镜像下载
  30. maven { url 'https://repo.huaweicloud.com/repository/maven' }
  31. //JitPack仓库下载
  32. maven { url 'https://jitpack.io' }
  33. mavenCentral()
  34. google()
  35. jcenter()
  36. flatDir {
  37. dirs 'libs'
  38. }
  39. }
  40. }
  41.  
  42. apply plugin: 'com.android.application'
  43. **APPLY_PLUGINS**
  44.  
  45. dependencies {
  46. implementation fileTree(dir: 'libs', include: ['*.jar'])
  47. **DEPS**}
  48.  
  49. android {
  50. compileSdkVersion **APIVERSION**
  51. buildToolsVersion '**BUILDTOOLS**'
  52.  
  53. compileOptions {
  54. sourceCompatibility JavaVersion.VERSION_1_8
  55. targetCompatibility JavaVersion.VERSION_1_8
  56. }
  57.  
  58. defaultConfig {
  59. minSdkVersion **MINSDKVERSION**
  60. targetSdkVersion **TARGETSDKVERSION**
  61. applicationId 'com.deltalpha.ipadapp'
  62. ndk {
  63. abiFilters **ABIFILTERS**
  64. }
  65. versionCode 1
  66. versionName '1.0.0'
  67. }
  68.  
  69. lintOptions {
  70. abortOnError false
  71. }
  72.  
  73. aaptOptions {
  74. noCompress = ['.unity3d', '.ress', '.resource', '.obb'**STREAMING_ASSETS**]
  75. }**SIGN**
  76. //必须在buildTypes之前声明
  77. signingConfigs {
  78. debug {
  79. keyAlias "deltalpha"
  80. keyPassword "123456"
  81. storePassword "123456"
  82. //keystore文件与Assets处于同级目录时
  83. storeFile rootProject.file("../../user.keystore")
  84. }
  85. release {
  86. keyAlias "deltalpha"
  87. keyPassword "123456"
  88. storePassword "123456"
  89. //keystore文件与Assets处于同级目录时
  90. storeFile rootProject.file("../../user.keystore")
  91. }
  92. }
  93.  
  94. buildTypes {
  95. debug {
  96. minifyEnabled **MINIFY_DEBUG**
  97. useProguard **PROGUARD_DEBUG**
  98. proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-unity.txt'**USER_PROGUARD**
  99. jniDebuggable true
  100. //使用签名配置
  101. signingConfig signingConfigs.debug
  102. }
  103. release {
  104. //关闭混淆
  105. minifyEnabled false
  106. useProguard **PROGUARD_RELEASE**
  107. proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-unity.txt'**USER_PROGUARD****SIGNCONFIG**
  108. //使用签名配置
  109. signingConfig signingConfigs.release
  110. }
  111. }**PACKAGING_OPTIONS****SPLITS**
  112. **BUILT_APK_LOCATION**
  113. bundle {
  114. language {
  115. enableSplit = false
  116. }
  117. density {
  118. enableSplit = false
  119. }
  120. abi {
  121. enableSplit = true
  122. }
  123. }
  124. }**SPLITS_VERSION_CODE****REPOSITORIES****SOURCE_BUILD_SETUP**

标签: Unity3d

Powered by emlog  蜀ICP备18021003号-1   sitemap

川公网安备 51019002001593号