Exclude resource files in Android

Anyone know how to exclude files to be copy into assets in Android from Resources? Wiki below doesn’t seem to work for me. I am on cocos2d-x 3.3

http://www.cocos2d-x.org/wiki/How_to_exclude_files_in_resources_directory_when_building_for_android

Thanks!

I don’t know it’s a formal way but it works.

modify proj.android/build-cfg.json like below.

{
    "ndk_module_path" :[
        "../cocos2d",
        "../cocos2d/cocos",
        "../cocos2d/external"
    ],
    "copy_resources": [
        {
            "from": "../Resources/data",
            "to": "data"
        },
        {
            "from": "../Resources/sounds/android",
            "to": "sounds/android"
        },
        {
            "from": "../Resources/texture",
            "to": "texture"
        }
    ]
}
1 Like

oh. there is an exclude parameter.
I didn’t know that.
I have to try this. :slight_smile:

exclude param works if sub-folder or file is relative from param

{
    "ndk_module_path" :[
        "../cocos2d",
        "../cocos2d/cocos",
        "../cocos2d/external"
    ],
    "copy_resources": [
        {
            "from": "../Resources/",
            "to": "",
            "exclude": [
                "sounds/ios" // "../Resources/sounds/ios" not work
            ]
        }
    ]
}
1 Like

I tried from Eclipse Run As > Android Application and exclude files doesn’t seem to work. Am I missing something?

Thanks!

I’m using cocos console to package apk.
http://www.cocos2d-x.org/wiki/Cocos2d-console

I see now. much thanks hzlov!

Thanks, the relative suggestion worked well for me. I had a setup like:

res/atlastitlemenu/1x/lotsoffiles png etc
res/atlastitlemenu/2x/lotsoffiles png etc
res/atlastitlemenu/3x/lotsoffiles png etc
res/atlasgame/1x/lotsoffiles png etc
res/atlasgame/2x/lotsoffiles png etc
res/atlasgame/3x/lotsoffiles png etc

and could exclude the low res files (1x) well with:

{
    "ndk_module_path" :[
        "../cocos2d",
        "../cocos2d/cocos",
        "../cocos2d/external"
    ],
    "copy_resources": [
        {
            "from": "../Resources",
            "to": "",
            "exclude": [
                "res/*/1x"
            ]
        }
    ]
}

A problem I have is I need to build through Eclipse, in order to use Fabric/Crashlytics…

How can the build process of Eclipse and command line (using cocos command) be made the same??