Problems loading plist files under android

Hello!

I’m trying to port my last game to android (I came from kobold2d), and I’m having problems loading a texture within android.

I use xcode for porting the game (I know how to debug, and it’s easy to me than eclipse). I set up correctly a helloworld example, compile under xcode, and run succesfully under iphone simulator and android device (compiled with build_native & ran with eclipse).

But I’m having problems loading a texture “created with texturePacker”, under iPhone simulator everything runs fine, but under android, the game does nothing. (And I don’t know how to debug), the game starts and exits without any error.

This is the code I use (and works for me in iphone)
@
CCSpriteFrameCache::sharedSpriteFrameCache()->addSpriteFramesWithFile(“textura01.plist”);
@

I test this code and works on iphone too, but neither on android.

@
CCSpriteFrameCache::sharedSpriteFrameCache()->addSpriteFramesWithFile(“textura01.plist”, “textura01.png”);
@

textura01.plist & textura01.png are in assets directory.

What can I do?

I found the problem, but I don’t have a solution.

The problem was loadint the sprite.

I use this code for loading an Sprite

@
boton_play = CCSprite::spriteWithSpriteFrameName(GameManager::sharedGameManager()->localized(“menu_play”));
@

This code works well on iphone, but on android doesn’t work.

GameManager is a singleton class and localized is a function that returns the image localizd, this is the code.

@
GameManager* GameManager::*sharedGameManager = NULL;

GameManager::~GameManager{
localizedStrings.release;
}
GameManager::GameManager
GameManager* GameManager::sharedGameManager {
if{
*sharedGameManager = new GameManager();
}
return _sharedGameManager;
}

const char* GameManager::localized(const char* str){
return localizedStrings.objectForKey(str)->toStdString().c_str();
}

void GameManager::loadSpanish(){
localizedStrings.setObject(new CCString(“menu_play_es.png”), “menu_play”);
localizedStrings.retain();
}
@

localizedString is defined as
@
cocos2d::CCMutableDictionary<std::string, cocos2d::CCString*> localizedStrings;
@

If I made the sprite with this code, everything goes fine.

@
boton_play = CCSprite::spriteWithSpriteFrameName(“menu_play_es.png”);
@

Any help will be aprecited.

i am having the same kind of a problem…

CCSpriteFrameCache::sharedSpriteFrameCache()>addSpriteFramesWithFile;
CCSpriteBatchNode *bgBatch = CCSpriteBatchNode::batchNodeWithFile;
this
>addChild(bgBatch);

CCSprite *bg = CCSprite::spriteWithSpriteFrameName(“mainmenu.png”);
bg~~>setPosition);
bg~~>setScale(0.95f);
bgBatch->addChild(bg);

when i run this code in android, a msg popup telling —— Get data from file(assets/mainmenu.png) failed —— and it is go way…. application exit with out errors…

Can somebody please answer this please???

Does the resources been put in assets.
If you run build_native.sh like HelloWorld, it will do the job for you.

yes… i did… i put and i can see them in assets folder in my android project

menu.plist
menu.png

files… both are generated from texture packer and…

mainmenu.png

is a frame inside the menu.png…

Do you think should i put mainmenu.png also inside the resource folder? it is the original image file that i have used to make that texture packer sprite sheet “menu.png+menu.plist”
if i need to put all the original files in sprite sheet with the them inside the resource folder, why should i use a sprite sheet? i can just use them as separate PNG file and get them using “CCSprite::spriteWithFile” right?
but i had to use “CCSprite::spriteWithSpriteFrameName” instead, because of i need to use them as frames of a sprite sheet.

thank you

i know… i must be doing something wrong here… Because there should be ppls out there… who got this working… so it should be something wrong with my code… so pls help me to figure it out what i am doing wrong here…

thank you

never mind… sorry about all the fuzz… it is just that my menu.plist got wrong info for its texture packer “textureFileName” if anybody got the same problem as mine… try checking detail inside your .plist file… and… believe me it is gonna save you a whole lot of time of debugging

thank you.

in my case it was file name. Anyone else stuck might also wanna check it, File names are case sensitive (x!=X).