我可以重构名称libcocos2dcpp.so吗?

时间:2015-03-11 22:56:24

标签: android cocos2d-x cocos2d-x-3.0 cocos2d-x-2.x

libcocos2dcpp.so位于路径proj.android \ libs \ armeabi

1)我想学习修改名称“ libcocos2dcpp.so ”更改为“randomname.so”之后的样子

(意图是,不确定,但如果人们不知道它在哪个方面制作,它可能有助于保护我的游戏源代码,我的意思是 cpp ,因为libcocos2dcpp.so有 cpp 最后)

2)另外,每次构建代码时,这个libcocos2dcpp.so都是新创建的,还是在整个生命周期内都保持不变?

1 个答案:

答案 0 :(得分:0)

您可以使用Android.mk文件中的LOCAL_MODULE_FILENAME更改您的lib名称。根据Android-NDK文件夹下的ANDROID-MK文档:

LOCAL_MODULE_FILENAME
    This variable is optional, and allows you to redefine the name of
    generated files. By default, module <foo> will always generate a
    static library named lib<foo>.a or a shared library named lib<foo>.so,
    which are standard Unix conventions.

    You can override this by defining LOCAL_MODULE_FILENAME, For example:

        LOCAL_MODULE := foo-version-1
        LOCAL_MODULE_FILENAME := libfoo

    NOTE: You should not put a path or file extension in your
    LOCAL_MODULE_FILENAME, these will be handled automatically by the
    build system.

您可以将您的lib文件名重命名为

LOCAL_MODULE := randomname
LOCAL_MODULE_FILENAME := librandomname

因此构建系统会自动将lib构建为librandomname.so

不要忘记更改Android Activity中的代码:

static {
    System.loadLibrary("randomname");
}