import org.apache.tools.ant.taskdefs.condition.Os apply plugin: 'com.android.application' def releaseTime() { return new Date().format("yyyyMMdd", TimeZone.getTimeZone("UTC")) } android { compileSdkVersion PROP_COMPILE_SDK_VERSION.toInteger() buildToolsVersion PROP_BUILD_TOOLS_VERSION defaultConfig { applicationId "com.edufound.mobile" minSdkVersion PROP_MIN_SDK_VERSION targetSdkVersion PROP_TARGET_SDK_VERSION versionCode 91000 versionName "9.1.0.0.0" flavorDimensions "versionCode" manifestPlaceholders = [UMENG_CHANNEL_VALUE: "2006"]//添加一个默认渠道号 ndk { abiFilters 'armeabi-v7a' } externalNativeBuild { ndkBuild { if (!project.hasProperty("PROP_NDK_MODE") || PROP_NDK_MODE.compareTo('none') != 0) { // skip the NDK Build step if PROP_NDK_MODE is none targets 'cocos2djs' arguments 'NDK_TOOLCHAIN_VERSION=clang' def module_paths = [project.file("G:/CocosCreator/cocoscreator_ide/CocosCreator_v2.4.0_20200622_win/resources/cocos2d-x"), project.file("G:/CocosCreator/cocoscreator_ide/CocosCreator_v2.4.0_20200622_win/resources/cocos2d-x/cocos"), project.file("G:/CocosCreator/cocoscreator_ide/CocosCreator_v2.4.0_20200622_win/resources/cocos2d-x/external")] if (Os.isFamily(Os.FAMILY_WINDOWS)) { arguments 'NDK_MODULE_PATH=' + module_paths.join(";") } else { arguments 'NDK_MODULE_PATH=' + module_paths.join(':') } arguments '-j' + Runtime.runtime.availableProcessors() abiFilters.addAll(PROP_APP_ABI.split(':').collect { it as String }) } } } } sourceSets.main { java.srcDirs "../src", "src" res.srcDirs "../res", 'res' jniLibs.srcDirs "../libs", 'libs' manifest.srcFile "AndroidManifest.xml" } externalNativeBuild { ndkBuild { if (!project.hasProperty("PROP_NDK_MODE") || PROP_NDK_MODE.compareTo('none') != 0) { // skip the NDK Build step if PROP_NDK_MODE is none path "jni/Android.mk" } } } signingConfigs { release { if (project.hasProperty("RELEASE_STORE_FILE")) { storeFile file(RELEASE_STORE_FILE) storePassword RELEASE_STORE_PASSWORD keyAlias RELEASE_KEY_ALIAS keyPassword RELEASE_KEY_PASSWORD } } } buildTypes { release { debuggable false jniDebuggable false renderscriptDebuggable false minifyEnabled true shrinkResources true zipAlignEnabled true proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' if (project.hasProperty("RELEASE_STORE_FILE")) { signingConfig signingConfigs.release } applicationVariants.all { variant -> variant.outputs.each { output -> def outputFile = output.outputFileName if (outputFile != null && output.outputFileName.endsWith('.apk')) { def fileName = "efunbox_tv_v${defaultConfig.versionCode}_${releaseTime()}_${variant.productFlavors[0].manifestPlaceholders.UMENG_CHANNEL_VALUE}_r.apk" def channel = variant.productFlavors[0].manifestPlaceholders.UMENG_CHANNEL_VALUE; def newoutputFile = ""; if (channel == ("2006")) { newoutputFile = "\\义方\\" } else if (channel == ("2001")) { newoutputFile = "\\应用宝\\" } else if (channel == ("2002")) { newoutputFile = "\\360应用市场\\" } else if (channel == ("2003")) { newoutputFile = "\\百度手机助手\\" } else if (channel == ("2008")) { newoutputFile = "\\小米\\" } else if (channel == ("2012")) { newoutputFile = "\\华科\\" } else if (channel == ("2013")) { newoutputFile = "\\步步高\\" } else if (channel == ("2015")) { newoutputFile = "\\状元才子\\" } else if (channel == ("2011")) { newoutputFile = "\\广西优学\\" } else if (channel == ("2007")) { newoutputFile = "\\vivo\\" } else if (channel == ("2007")) { newoutputFile = "\\oppo\\" } output.outputFileName = new File(newoutputFile, fileName) } } } externalNativeBuild { ndkBuild { arguments 'NDK_DEBUG=0' } } } // debug { // debuggable true // jniDebuggable true // renderscriptDebuggable true // externalNativeBuild { // ndkBuild { // arguments 'NDK_DEBUG=1' // } // } // } } productFlavors { //义方 channel_efunbox { signingConfig signingConfigs.release manifestPlaceholders = [ appCode: "2006", appIcon: "@drawable/icon", ] } //应用宝 channel_yyb { signingConfig signingConfigs.release manifestPlaceholders = [ appCode: "2001", appIcon: "@drawable/icon", ] } //360应用市场 channel_360 { signingConfig signingConfigs.release manifestPlaceholders = [ appCode: "2002", appIcon: "@drawable/icon", ] } //百度手机助手 channel_bdsjzs { signingConfig signingConfigs.release manifestPlaceholders = [ appCode: "2003", appIcon: "@drawable/icon", ] } //vivo channel_vivo { signingConfig signingConfigs.release manifestPlaceholders = [ appCode: "2007", appIcon: "@drawable/icon", ] } //小米 channel_xiaomi { signingConfig signingConfigs.release manifestPlaceholders = [ appCode: "2008", appIcon: "@drawable/icon", ] } //华科 channel_huake { signingConfig signingConfigs.release manifestPlaceholders = [ appCode: "2012", appIcon: "@drawable/icon", ] } //步步高 channel_bubugao { signingConfig signingConfigs.release manifestPlaceholders = [ appCode: "2013", appIcon: "@drawable/icon", ] } //状元才子 channel_zhuangyuancaizi { signingConfig signingConfigs.release manifestPlaceholders = [ appCode: "2015", appIcon: "@drawable/icon", ] } //广西优学 channel_guangxiyouxue { signingConfig signingConfigs.release manifestPlaceholders = [ appCode: "2011", appIcon: "@drawable/icon", ] } //字节跳动 channel_bytedance { signingConfig signingConfigs.release manifestPlaceholders = [ appCode: "2020", appIcon: "@drawable/icon", ] } //字节跳动 channel_oppo { signingConfig signingConfigs.release manifestPlaceholders = [ appCode: "2004", appIcon: "@drawable/icon", ] } } productFlavors.all { flavor -> flavor.manifestPlaceholders = [UMENG_CHANNEL_VALUE: manifestPlaceholders.appCode, icon: manifestPlaceholders.appIcon] } compileOptions { sourceCompatibility JavaVersion.VERSION_1_8 targetCompatibility JavaVersion.VERSION_1_8 } } android.applicationVariants.all { variant -> // delete previous files first delete "${buildDir}/intermediates/merged_assets/${variant.dirName}" //修改 报警错误 API 'variant.getMergeAssets()' is obsolete and has been replaced with 'variant.getMergeAssetsProvider()'.It will be removed at the end of 2019. // variant.mergeAssets.doLast { variant.mergeAssetsProvider.get().doLast { def sourceDir = "${buildDir}/../../../../.." // def sourceDir = "${buildDir}/../../../build/jsb-link" copy { from "${sourceDir}/assets" into "${outputDir}/assets" into outputDir.dir("assets") } copy { from "${sourceDir}/src" into "${outputDir}/src" into outputDir.dir("src") } copy { from "${sourceDir}/jsb-adapter" into "${outputDir}/jsb-adapter" into outputDir.dir("jsb-adapter") } copy { from "${sourceDir}/main.js" from "${sourceDir}/project.json" into outputDir } } } dependencies { implementation fileTree(dir: '../libs', include: ['*.jar', '*.aar']) implementation fileTree(dir: 'libs', include: ['*.jar', '*.aar']) implementation "com.android.support:appcompat-v7:28.0.0" implementation fileTree(dir: "G:/CocosCreator/cocoscreator_ide/CocosCreator_v2.4.0_20200622_win/resources/cocos2d-x/cocos/platform/android/java/libs", include: ['*.jar']) implementation 'com.google.code.gson:gson:2.8.6' implementation 'com.google.android.gms:play-services-instantapps:16.0.0' //微信登录、微信支付等 implementation "com.tencent.mm.opensdk:wechat-sdk-android-with-mta:+" implementation project(':libcocos2dx') // 友盟基础组件库(所有友盟业务SDK都依赖基础组件库) implementation 'com.umeng.umsdk:common:9.4.4'// (必选) implementation 'com.umeng.umsdk:asms:1.4.1'// asms包依赖必选 // implementation 'com.umeng.umsdk:abtest:1.0.0'//使用U-App中ABTest能力,可选 //友盟Push依赖 api 'com.umeng.umsdk:push:6.4.5' //友盟P厂商推送渠道(小米) api 'com.umeng.umsdk:xiaomi-umengaccs:1.2.6' implementation 'com.umeng.umsdk:xiaomi-push:4.8.1' //友盟P厂商推送(华为) api 'com.umeng.umsdk:huawei-umengaccs:1.3.5' api 'com.huawei.hms:push:5.3.0.304' //友盟厂商推送(魅族) api 'com.umeng.umsdk:meizu-umengaccs:1.1.5' api 'com.umeng.umsdk:meizu-push:4.1.4' //友盟厂商推送(OPPO) api 'com.umeng.umsdk:oppo-umengaccs:1.0.7-fix' implementation 'com.umeng.umsdk:oppo-push:2.1.0' //友盟厂商(ViVo) api 'com.umeng.umsdk:vivo-umengaccs:1.1.5' implementation 'com.umeng.umsdk:vivo-push:3.0.0.3' }