Cocos2dx 3.0 project can't load scene json file

My cocos2dx android project contains 38M files in assets
I use the code to create Cocostudio Scene below:

local node = SceneReader:sharedSceneReader():createNodeWithSceneFile("./publish/SceneLoading.json")

I run and install app in eclipse,
and the SceneLoading.json file exist in the apk asset/publish folder
but I got this error below:

04-08 17:54:06.398: D/cocos2d-x debug info(15616): FileUtils::fullPathForFilename ./publish/SceneLoading.json
04-08 17:54:06.398: D/cocos2d-x debug info(15616): cocos2d: fullPathForFilename: No file found at ./publish/SceneLoading.json. Possible missing file.
04-08 17:54:06.398: D/CCFileUtilsAndroid.cpp(15616): relative path = ./publish/SceneLoading.json
04-08 17:54:06.398: D/CCFileUtilsAndroid.cpp(15616): asset is nullptr
04-08 17:55:05.609: D/dalvikvm(15616): threadid=11: thread exiting, not yet detached (count=0)
04-08 17:55:05.625: A/libc(15616): Fatal signal 11 (SIGSEGV) at 0x00000000 (code=1), thread 15671 (.heididl.church)

I don’t know how to fix it.
Can anybody help?
Thanks.
Regards

I move the SceneLoading.json to asset folder, then remove ./publish path code
It can read and show the scene.
So createNodeWithSceneFile function doesn’t support subfolder in android?

You can try to debug the fullPathForFilename to trace and refer to the luaTests/CocoStudioTest/CocoStudioSceneTest.

I finally add this code to fix it.
cc.FileUtils:getInstance():addSearchPath(“publish/”)

and remove subFolder path
local node = SceneReader:sharedSceneReader():createNodeWithSceneFile(“SceneLoading.json”)

1 Like