Get data from file(assets/ipad/HelloWorld.png) failed!

Hello guys,

I have a problem with the sample HelloCpp and i am desperate :wink:

My environment:

Mac OSX 10.8.2
cocos2d-2.1beta3-x-2.1.0
android-ndk-r8d-darwin-x86.tar.bz2

The proj.ios of the sample is running fine in the xcode emulator but i have problems get it running on my Android HTC One X.
I am able to build the apk file with the attached makefile and when i unzip it has the assets folder included and images in it (see attached screenshot), but after the installation of the apk file on the device the app tells me that it is not able to load the Sprites in assets/ipad (see attached screenshot).

I have removed everything from HelloWorldScene.cpp (see attached file) there is ‘almost’ only the create call of the CCSprite class left.

I really hope someone can help me. Or has the same problem at least. End of wisdom.
Chris


Screenshot_2013-01-11-13-14-30.png (51.6 KB)


makefile.zip (0.3 KB)


HelloWorldScene.cpp.zip (0.5 KB)


Screen Shot 2013-01-11 at 1.26.28 PM.png (22.1 KB)

I have same problem.

Dmytro Taradayka wrote:

I have same problem.

Do you use the same version of cocos2dx and android ndk?
What did you try so far ?

I tried different versions of cocos2dx now.
Am I the only one who has problems get the sample HelloCcp running?

I started debugging the CCFileUtils.ccp in platform/android too.

s_strResourcePath

Is it correct to load a png file with pData = CCFileUtils::getFileDataFromZip(s_strResourcePath.c_str(), fullPath.c_str(), pSize); ?
Because thats the line where the program is running into.

the value of s_strResourcePath is /data/app/org.cocos2dx.hellocpp.apk and fullpath is assets/ipad/HelloWorld.png.
Thats an included sample, and no sourcecode written by me. I’d like to start writing sourcecode with cocos2d-x, but it seems i have no luck.

I Have the same problem.then I use “android-ndk-r7-crystax-5.beta3” have the problem. It work well when I choose “android-ndk-r8b” .I don’t know why? Maybe there are bugs of NDK!

I have the same problem, I think it started after I switched to “android-ndk-r7-crystax-5.beta3” as well.
I have “android-ndk-r7b” and will try it later today and confirm…

I tried using “android-ndk-r7b” and it worked, I also tried “android-ndk-r6-crystax-2” and it worked as well…

So you’ll have this problem if you use “android-ndk-r7-crystax-5.beta3”.

Note: clean the project files before building

this bug disappeared when i copied resources from assets/ipad/ to assets/
OR in code you must write this path “ipad/HelloWorld.png” to resources

mac os 10.7.5
cocos2d-2.1beta3-x-2.1.0
android-ndk-r8
android-ndk-r7

I had this issue also, it was a tab bit confusing but basically i worked out that the application is unable to locate the image file, even though it was in the directory i had noticed that i had not added the new files to Xcode, once i added the new files to the project it worked fine.

Sorry for the bump but i noticed this was the first result in my google search for this issue.

I found a solution via stack overflow that worked for me:

basically, in xcode, set compress png files to no, and remove text metadata from png files to no.