CCLOG is not working on android

Hi, I’m using cocos2d-x v3.3 to make and android application. but I don’t know why CCLOG is not working. Iv seen other related posts (like this) but non of them could help me.
Does anyone know how can I fix this problem?

__android_log_print works fine in my program. But using CCLOG is much easier.

Hi,
Just add this line in your Application.mk
APP_DEBUG :=1

and use
CCLog(“some thing happen…”);

work fine for me :smile:

Iv added APP_DEBUG :=1 to my Application.mk but I still have that problem.
My application.mk looks like this:

    APP_STL := c++_static
    NDK_TOOLCHAIN_VERSION=clang

    APP_CPPFLAGS := -frtti -DCC_ENABLE_CHIPMUNK_INTEGRATION=1 -std=c++11 -fsigned-char
    APP_LDFLAGS := -latomic

    ifeq ($(NDK_DEBUG),1)
  

APP_CPPFLAGS += -DCOCOS2D_DEBUG=1
      APP_OPTIM := debug

 

else

              APP_CPPFLAGS += -DNDEBUG
              APP_OPTIM := release
        endif

and my android.mk:

LOCAL_PATH := $(call my-dir)

include $(CLEAR_VARS)

$(call import-add-path,$(LOCAL_PATH)/../../cocos2d)
$(call import-add-path,$(LOCAL_PATH)/../../cocos2d/external)
$(call import-add-path,$(LOCAL_PATH)/../../cocos2d/cocos)

LOCAL_MODULE := cocos2dcpp_shared


LOCAL_MODULE_FILENAME := libcocos2dcpp

LOCAL_SRC_FILES := hellocpp/main.cpp \

…/…/Classes/AppDelegate.cpp
                    …/…/Classes/SplashScene.cpp
                    …/…/Classes/GameOverScene.cpp
                    …/…/Classes/GameScene.cpp
                    …/…/Classes/MainMenuScene.cpp
                    …/…/Classes/Pipe.cpp
                    …/…/Classes/Bird.cpp

LOCAL_C_INCLUDES := $(LOCAL_PATH)/../../Classes

LOCAL_STATIC_LIBRARIES := cocos2dx_static

include $(BUILD_SHARED_LIBRARY)

$(call import-module,.)

just use this on the top of your code

#define COCOS2D_DEBUG 1
1 Like