Android(安卓)关于build.gradle的一些配置问题
16lz
2022-03-17
apply plugin: 'com.android.application'// 打包时间static def buildTime() { return new Date().format("yyyy-MM-dd-HH-mm-ss", TimeZone.getTimeZone("GMT+08:00"))}android { compileSdkVersion 25 buildToolsVersion '27.0.3' // 指定签名文件 signingConfigs { test { keyAlias 'test' keyPassword 'test123' storeFile file('../test.jks') storePassword 'test123' } } defaultConfig { applicationId "top.tobin.game" minSdkVersion 14 targetSdkVersion 25 versionCode 100 versionName "1.0.0" // dex突破65535的限制 multiDexEnabled true // 设置AndroidManifest.xml 里面icon 的value默认值 manifestPlaceholders = [app_icon : "@mipmap/ic_launcher"] resValue "string", "app_name", "Game_Default" } //执行lint检查,有任何的错误或者警告提示,都会终止构建,我们可以将其关掉。 lintOptions { checkReleaseBuilds false abortOnError false // 防止在发布的时候出现因MissingTranslation导致Build Failed! disable 'MissingTranslation' } dexOptions { javaMaxHeapSize "8g" jumboMode = true preDexLibraries = false threadCount ="8" } allprojects { // 加快 Android Studio 编译 tasks.withType(JavaCompile) { // 使在一个单独的守护进程编译 options.fork = true // 增量编译 options.incremental = true } repositories { jcenter() } } buildTypes { release { minifyEnabled false proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' signingConfig signingConfigs.test } applicationVariants.all { variant -> variant.outputs.all { output -> def versionName = variant.versionName def versionCode = variant.versionCode def buildType = variant.buildType.name if (variant.buildType.name == 'debug') { outputFileName = "Game_${variant.flavorName}_${versionName}_${versionCode}_${buildType}.apk" } else { outputFileName = "Game_${variant.flavorName}_v${versionName}_${buildTime()}_${buildType}.apk" } } } } flavorDimensions "default" productFlavors { dev { dimension "default" resValue "string", "app_name", "GameMultichannel" applicationId 'top.tobin.game' manifestPlaceholders = [ENVIRONMENT: "dev", app_icon : "@mipmap/ic_launcher"] } common { dimension "default" applicationId 'top.tobin.game.commonsdk' versionCode 101 versionName "1.0.1" resValue "string", "app_name", "Game_Common" } ysdk { dimension "default" applicationId 'top.tobin.game.tencent' versionCode 105 versionName "1.0.5" resValue "string", "app_name", "Game_YSDK" } }}repositories { flatDir { dirs '../YSDK/libs' dirs 'libs' }}dependencies { api fileTree(include: ['*.jar'], dir: 'libs') testImplementation 'junit:junit:4.12' androidTestImplementation 'com.android.support.test:runner:1.0.1' api project(':sdkproxy') commonApi project(':commonSDK') ysdkApi project(':YSDK')}
更多相关文章
- Android(安卓)增量更新实例
- Android(安卓)DEX方法超过64K和gradle编译OOM解决方案
- 《Android系统学习》第五章:编译Android的JDK环境
- 解决Cocos2d-x3.1编译生成Android程序出现Android(安卓)NDK:Abor
- Android(安卓)JNI入门第一篇――HelloWord
- Android(安卓)APP增量升级的实现方式
- android反编译工具之jadx简介
- ubuntu 16.04 编译 android 6.0 错误
- android开发环境_反编译