Cocos Code IDE 1.0.1
cocos studio 2.0 beta0
cocos2d-x 3.3 rc0
I created a scene with cocos studio 2.0 and it works on windows very well.
I tried it on my android-device but no images are displayed. Only the labels are shown.
My smartphone has android 4.4.4 and the apk was api 10 and 19.
I am new to Cocos2d-x, and am actually using the Javascript bindings so I may be completely missing something. I have also never built an Android app before so this is a learning/hacking experience. To be clear though, I have everything working perfectly fine on iOS, I am only having issues on Android.
I started logging out from CCFileUtils-Android.cpp to try and figure out whats going on. It seems like there is some funny business going on when the FileUtils class looks for images on Android. The ‘Search Resolution Paths’ and ‘Search Paths’ only appear to be respected when dealing with .ccbi files.
In my project-cfg.json file, I copy 4 different versions of my images assets into 4 different “root” folders. I have a phone, phonehd, tablet, and tablethd folder.
If I duplicate my ccbi’s across all 4 folders, and setup my search path at runtime to one of them, then Cocos2d-x can find the ccbi files.
For example:
If loaded on a phone, the search path gets set to ‘phone’.
If I log out the output of the ‘findFullPathForFile’ method, it finds the scene at ‘phone/MainScene.cbbi’. But when it runs on any of the image files, all that is returned is ‘background.png’, which means it couldn’t find the files.
It looks like the search paths are never being respected when images are loaded on Android. Either that or the images are moved to a completely different place on Android. Are we just missing something here?
At first: How do you publish your game to android? Are you using cocos code ide and debug option or are you building an apk? If you build an apk, open it with 7zip and look at the files. You can check if they are where they should be.
I figured out my issue, which may be the same as yours.
My images were being stored in a subdirectory called Assets. This is the same name as the “resources” folder on Android. So all of the images relative paths looked like ‘assets/imageFile.png’.
The FileUtil cuts the ‘assets/’ part of the path off.
I simply changed the subdirectory name to ‘assetsForGame’ and republished from CocosBuilder, then all of my images loaded.
I have same problem with Michael
And I don’t know how to solve that, pls help
I’m using cocos studio 2.3.3 (lastest version) to make UI and export to csb files (path export is “Resources”)
When I build it on android,sprite or image be invisible (but resource of button is working)