cocos2dx工程部署到android-studio中,build.gradle的写法

前端之家收集整理的这篇文章主要介绍了cocos2dx工程部署到android-studio中,build.gradle的写法前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。
apply plugin: 'com.android.application'

android {
    compileSdkVersion 22
    buildToolsVersion "22.0.1"

    defaultConfig {
        applicationId "org.cocos2dx.DobiParkour"
        minSdkVersion 14
        targetSdkVersion 22
        versionCode 1
        versionName "1.0"

        // dex突破65535的限制
        multiDexEnabled true
        // 默认渠道
        manifestPlaceholders = [CHANNEL_VALUE: "Youmi"]

    }

    signingConfigs {
        release {
        }
    }

    buildTypes {
        debug{

        }
        release {
            // 不显示Log
            buildConfigField "boolean","LOG_DEBUG","false"
            minifyEnabled false
            zipAlignEnabled true
            // 移除无用的resource文件
            shrinkResources true
            proguardFiles getDefaultProguardFile('proguard-android.txt'),'proguard-rules.pro'
            signingConfig signingConfigs.release
            applicationVariants.all { variant ->
                variant.outputs.each { output ->
                    def outputFile = output.outputFile
                    if (outputFile != null && outputFile.name.endsWith('.apk')) {
                        // 输出apk名称为dobi_v1.0_wandoujia.apk
                        def fileName = "DobiParkour_${variant.productFlavors[0].name}.apk"
                        output.outputFile = new File(outputFile.parent,fileName)
                    }
                }
            }
        }
    }

    sourceSets {
        main {
            //打包.so库
            jniLibs.srcDirs = ['libs']
            //打包cocos2dx的resource资源
            assets.srcDirs= ['assets']
        }
    }

    // 多渠道打包
    productFlavors {
        Youmi {}
        Xindian {}
        Saile {}
        Youyoucun {}
        Kuhua {}
        Sikai {}
        Damengshikong {}
        jimeichuanmei {}
        Dianle {}
        Manleyou {}
        Gude {}
    }
    productFlavors.all { flavor ->
        flavor.manifestPlaceholders = [CHANNEL_VALUE: name]
    }
}
dependencies {
    compile fileTree(dir: 'libs',include: ['*.jar','.so'])
    compile project(':libcocos2dx')
    compile files('libs/alipaysdk.jar')
    compile files('libs/alipaysecsdk.jar')
    compile files('libs/alipayutdid.jar')
    compile files('libs/android-support-v4.jar')
    compile files('libs/BmobPay_V1.0.2.jar')
    compile files('libs/EAccount_SDK_Android_V3.0.9_build201509091117.jar')
    compile files('libs/fastjson-1.2.5.jar')
    compile files('libs/MobLogCollector.jar')
    compile files('libs/MobTools.jar')
    compile files('libs/open_sdk_r5509.jar')
    compile files('libs/ShareSDK-Core-2.6.3.jar')
    compile files('libs/ShareSDK-QQ-2.6.3.jar')
    compile files('libs/ShareSDK-QZone-2.6.3.jar')
    compile files('libs/ShareSDK-SinaWeibo-2.6.3.jar')
    compile files('libs/ShareSDK-Wechat-2.6.3.jar')
    compile files('libs/ShareSDK-Wechat-Core-2.6.3.jar')
    compile files('libs/ShareSDK-Wechat-Moments-2.6.3.jar')
    compile files('libs/volley.jar')
}

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

原文链接:https://www.f2er.com/cocos2dx/340349.html

猜你在找的Cocos2d-x相关文章