cocos2d-x 3.17 gradle as3.2.1+4.6 以上拷贝src+res

android.applicationVariants.all { variant ->
    // delete previous files first
    delete "${buildDir}/intermediates/assets/${variant.dirName}"

    variant.mergeAssets.doLast {

        if ([图片上传失败...(image-185774-1559818286641)]

variant.buildType.name == "release") {
            copy {
                from "${buildDir}/../../../../../res"
                into "${buildDir}/intermediates/merged_assets/release/mergeReleaseAssets/out/res"
            }

            copy {
                from "${buildDir}/../../../../../src"
                into "${buildDir}/intermediates/merged_assets/release/mergeReleaseAssets/out/src"
            }

            copy {
                from "${buildDir}/../../../../cocos2d-x/cocos/scripting/js-bindings/script"
                into  "${buildDir}/intermediates/merged_assets/release/mergeReleaseAssets/out/script"
            }

            copy {
                from "${buildDir}/../../../../../main.js"
                from "${buildDir}/../../../../../project.json"
                into "${buildDir}/intermediates/merged_assets/release/mergeReleaseAssets/out"
            }
        }else{
            copy {
                from "${buildDir}/../../../../../res"
                into "${buildDir}/intermediates/merged_assets/debug/mergeDebugAssets/out/res"
            }

            copy {
                from "${buildDir}/../../../../../src"
                into "${buildDir}/intermediates/merged_assets/debug/mergeDebugAssets/out/src"
            }

            copy {
                from "${buildDir}/../../../../cocos2d-x/cocos/scripting/js-bindings/script"
                into  "${buildDir}/intermediates/merged_assets/debug/mergeDebugAssets/out/script"
            }

            copy {
                from "${buildDir}/../../../../../main.js"
                from "${buildDir}/../../../../../project.json"
                into "${buildDir}/intermediates/merged_assets/debug/mergeDebugAssets/out"
            }
        }

        // compile the scripts if necessary
        def compileScript = ([图片上传失败...(image-ee6207-1559818286641)]

variant.name.compareTo('release') == 0)
        if (project.hasProperty('PROP_COMPILE_SCRIPT')) {
            compileScript = (PROP_COMPILE_SCRIPT.compareTo('1') == 0)
        }

        if (compileScript) {
            compileJS("${buildDir}/intermediates/assets/${variant.dirName}",
                      "${buildDir}/intermediates/assets/${variant.dirName}")
        }
    }
}

转载于:https://www.jianshu.com/p/b15c992c4e0b

猜你喜欢

转载自blog.csdn.net/weixin_34023863/article/details/91280906
0条评论
添加一条新回复