Get data from file(assets/) failed! w/ HelloWorld

I am a n00b when it comes to android and I am trying to get the HelloWorld for Android going. I do have it building sucessfully to a few Android devices, but whenever I push the app to the background and then click the icon I am getting this error with the graphics (obviously) blanked out.

I’ve attached a screenshot from a Kindle Fire.

Any help?

Thanks,
Chief


device-2012-03-30-100815.png (16.7 KB)

It’s 0.13.0-beta’s bug…
reload texture has problem on android…
don’t waste time on it. use 0.12.0 until they fix this bug.

ok… take me 5 minutes to check this stupid bug.
just modify CCFileUtils.cpp

const char* CCFileUtils::fullPathFromRelativePath(const char pszRelativePath, ccResolutionTypepResolutionType)
{
return “”;
}

this method always return empty string which makes CCTextureCache::addImage got empty filepath before add texture into volatile texture pool
modify return “”; to return pszRelativePath;
and every thing works fine again.

But the real problem is this (or these) function should be in a file such as CCFileUtils_ios.mm and use some preprocessor to build/run the right function for each platform.

Thanks for the explanation and fix!

I am sorry for this stupid error.
#1115 is created for it.

Thanks for fixing #1115, but it looks like a new bug has been introduced in 0.13-beta which causes the same error message “Get data from file(assets/) failed” when you background the android app and then foreground it again.

I put the following CCLog message in CCFileUtils::getFileData to track down the bug:

if (pszFileName[0] != '/')
{
    // read from apk
    fullPath.insert(0, "assets/");
    CCLog("gettingFileData resource path: '%s' full path: '%s'", s_strResourcePath.c_str(), fullPath.c_str());
    pData =  CCFileUtils::getFileDataFromZip(s_strResourcePath.c_str(), fullPath.c_str(), pSize);
}

And when I run the app for the first time, I get these log messages from adb logcat | grep cocos2d:

D/cocos2d-x debug info( 5530): gettingFileData resource path: '/data/app/com.mycompany.mygame-1.apk' full path: 'assets/area02_bkg0.jpg'
D/cocos2d-x debug info( 5530): gettingFileData resource path: '/data/app/com.mycompany.mygame-1.apk' full path: 'assets/area02_bkg1.png'
D/cocos2d-x debug info( 5530): gettingFileData resource path: '/data/app/com.mycompany.mygame-1.apk' full path: 'assets/level01.tmx'
D/cocos2d-x debug info( 5530): gettingFileData resource path: '/data/app/com.mycompany.mygame-1.apk' full path: 'assets/area02_level_tiles.png'
D/cocos2d-x debug info( 5530): gettingFileData resource path: '/data/app/com.mycompany.mygame-1.apk' full path: 'assets/Billy.plist'
D/cocos2d-x debug info( 5530): gettingFileData resource path: '/data/app/com.mycompany.mygame-1.apk' full path: 'assets/Billy.pvr.ccz'
D/cocos2d-x debug info( 5530): gettingFileData resource path: '/data/app/com.mycompany.mygame-1.apk' full path: 'assets/bat-morphing-stopped-s0005.png'
D/cocos2d-x debug info( 5530): gettingFileData resource path: '/data/app/com.mycompany.mygame-1.apk' full path: 'assets/blocks.png'
D/cocos2d-x debug info( 5530): gettingFileData resource path: '/data/app/com.mycompany.mygame-1.apk' full path: 'assets/Billy profile.plist'

When the app is foregrounded again it generates the following log messages:

D/cocos2d-x debug info( 5530): gettingFileData resource path: '/data/app/com.mycompany.mygame-1.apk' full path: 'assets/'
D/cocos2d-x debug info( 5530): gettingFileData resource path: '/data/app/com.mycompany.mygame-1.apk' full path: 'assets/'
D/cocos2d-x debug info( 5530): gettingFileData resource path: '/data/app/com.mycompany.mygame-1.apk' full path: 'assets/'
D/cocos2d-x debug info( 5530): gettingFileData resource path: '/data/app/com.mycompany.mygame-1.apk' full path: 'assets/Billy.pvr.ccz'
D/cocos2d-x debug info( 5530): gettingFileData resource path: '/data/app/com.mycompany.mygame-1.apk' full path: 'assets/'
D/cocos2d-x debug info( 5530): gettingFileData resource path: '/data/app/com.mycompany.mygame-1.apk' full path: 'assets/'

That’s all I could figure out for now. Note that the .pvr.ccz file was re-loaded successfully. So it seems like the normal CCSprites loaded from a .png are the ones that are failing to reload.

I’m experiencing the same problem.
Anyone found a fix to it?

I got the same issue. Changing CCFileUtils.cpp

/// functions iOS specific
const char* CCFileUtils::fullPathFromRelativePath(const char *pszRelativePath, ccResolutionType *pResolutionType)
{
    return "";
}

to

/// functions iOS specific
const char* CCFileUtils::fullPathFromRelativePath(const char *pszRelativePath, ccResolutionType *pResolutionType)
{
    return pszRelativePath;
}

seems to have fixed it.

Thanks.The changing above resolves these problem(include chipmunk,Box2D,and Lua) of 13.0-beta.
Sorry I already upload a movie of these problem as below.


but it has been corrected as the contents of “fully resolved” right now so please forgive me.

Incidentally,I was add a button of the sample of HelloWorld to chipmunk,Box2D because this button certainly exit the apps everytime.
(Please also see below.)


(and this move.)

(or)

I got same issue on windows. Latest cocos2d-x and VS Express. .h-file fixed to relative, but didn’t uses it.

Dony Karlos wrote:

I got same issue on windows. Latest cocos2d-x and VS Express. .h-file fixed to relative, but didn’t uses it.

I had the same dialog box with VS Express c*+ 2008
I was using level helper,sprite helper and cocos2d-x 2.0x2.0.4
I solved it by simply putting the images*in a certain filter hierarchy within the project tree+.

My problem was that the png file was not found where the program looked for it I see that your error comes from a template image, did you moved something?

Also, When I loaded the png images for the first time, VS told me that there was no rule to compile the .png file, I have no Idea ifthis has to do but I just ignored it.