cocos2dx工程android-studio的build.gradle的写法

  1 apply plugin: 'com.android.application'
  2 
  3 android {
  4     compileSdkVersion 22
  5     buildToolsVersion "22.0.1"
  6 
  7     defaultConfig {
  8         applicationId "org.cocos2dx.DobiParkour"
  9         minSdkVersion 14
 10         targetSdkVersion 22
 11         versionCode 1
 12         versionName "1.0"
 13 
 14         // dex突破65535的限制
 15         multiDexEnabled true
 16         // 默认渠道
 17         manifestPlaceholders = [CHANNEL_VALUE: "Youmi"]
 18 
 19     }
 20 
 21     signingConfigs {
 22         release {
 23             storeFile file("D:\\keys\\dobikeys")
 24             storePassword  "21cndobi"
 25             keyAlias "dobi"
 26             keyPassword "21cndobi"
 27         }
 28     }
 29 
 30     buildTypes {
 31         debug{
 32 
 33         }
 34         release {
 35             // 不显示Log
 36             buildConfigField "boolean", "LOG_DEBUG", "false"
 37             minifyEnabled false
 38             zipAlignEnabled true
 39             // 移除无用的resource文件
 40             shrinkResources true
 41             proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
 42             signingConfig signingConfigs.release
 43             applicationVariants.all { variant ->
 44                 variant.outputs.each { output ->
 45                     def outputFile = output.outputFile
 46                     if (outputFile != null && outputFile.name.endsWith('.apk')) {
 47                         // 输出apk名称为dobi_v1.0_wandoujia.apk
 48                         def fileName = "DobiParkour_${variant.productFlavors[0].name}.apk"
 49                         output.outputFile = new File(outputFile.parent, fileName)
 50                     }
 51                 }
 52             }
 53         }
 54     }
 55 
 56     sourceSets {
 57         main {
 58             //打包.so库
 59             jniLibs.srcDirs = ['libs']
 60             //打包cocos2dx的resource资源
 61             assets.srcDirs= ['assets']
 62         }
 63     }
 64 
 65     // UED多渠道打包
 66     productFlavors {
 67         dobi {}
 68         Youmi {}
 69         Xindian {}
 70         Saile {}
 71         Youyoucun {}
 72         Kuhua {}
 73         Sikai {}
 74         Damengshikong {}
 75         jimeichuanmei {}
 76         Dianle {}
 77         Manleyou {}
 78         Gude {}
 79     }
 80     productFlavors.all { flavor ->
 81         flavor.manifestPlaceholders = [CHANNEL_VALUE: name]
 82     }
 83 }
 84 dependencies {
 85     compile fileTree(dir: 'libs', include: ['*.jar','.so'])
 86     compile project(':libcocos2dx')
 87     compile files('libs/alipaysdk.jar')
 88     compile files('libs/alipaysecsdk.jar')
 89     compile files('libs/alipayutdid.jar')
 90     compile files('libs/android-support-v4.jar')
 91     compile files('libs/BmobPay_V1.0.2.jar')
 92     compile files('libs/EAccount_SDK_Android_V3.0.9_build201509091117.jar')
 93     compile files('libs/fastjson-1.2.5.jar')
 94     compile files('libs/MobLogCollector.jar')
 95     compile files('libs/MobTools.jar')
 96     compile files('libs/open_sdk_r5509.jar')
 97     compile files('libs/ShareSDK-Core-2.6.3.jar')
 98     compile files('libs/ShareSDK-QQ-2.6.3.jar')
 99     compile files('libs/ShareSDK-QZone-2.6.3.jar')
100     compile files('libs/ShareSDK-SinaWeibo-2.6.3.jar')
101     compile files('libs/ShareSDK-Wechat-2.6.3.jar')
102     compile files('libs/ShareSDK-Wechat-Core-2.6.3.jar')
103     compile files('libs/ShareSDK-Wechat-Moments-2.6.3.jar')
104     compile files('libs/volley.jar')
105 }

 

包含了多渠道打包的方法以及打包.so库和cocos2dx中resources的方法。

注释已经写得很清楚,就不写那么多了(懒癌发作,先滚了...)

posted @ 2015-12-24 15:10  little-byte  阅读(952)  评论(0)    收藏  举报