Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

Android / T2 Android / Eclipse C++ - where to place assets?

Author
Message
b83
7
Years of Service
User Offline
Joined: 30th Nov 2011
Location:
Posted: 3rd Dec 2011 23:23
Where do I place my image files for a Tier 2 Android project using Eclipse/C++? I've tried putting them in the "res" folder with no luck.. I've also tried them in an "assets" folder that also doesn't work. I am simply trying to get the Box2D - Box2D Native example to run on my phone. The physics objects show up on the screen but the images are just white with red X's on them.

any help is appreciated, Thanks!
b83
7
Years of Service
User Offline
Joined: 30th Nov 2011
Location:
Posted: 4th Dec 2011 05:18
I have placed my image file in every possible folder in my project's directory, even in a folder called 'media' and yet the image still fails to load.
bjadams
AGK Backer
11
Years of Service
User Offline
Joined: 29th Mar 2008
Location:
Posted: 4th Dec 2011 08:52 Edited at: 4th Dec 2011 08:53
create a folder called ASSETS (lowercase) in your project directory and put all media there. Press f5 in Eclipse to refresh project. Also remember to name your files wisely, as Android is CASE SENSITIVE.
Mobiius
Valued Member
16
Years of Service
User Offline
Joined: 27th Feb 2003
Location: The Cold North
Posted: 4th Dec 2011 10:19
The assets folder did not work for me. I had to create a folder called media, and put it all in there.

My signature is NOT a moderator plaything! Stop changing it!
b83
7
Years of Service
User Offline
Joined: 30th Nov 2011
Location:
Posted: 4th Dec 2011 17:43
Could this be why the image fails to load? I've tried searching google to find out what MM_PARSER_LIB is but didn't find anything useful. These message's shows up in the debug log.

Quote: "12-04 11:38:21.933: V/ExtendedExtractor(6916): Failed to open MM_PARSER_LIB, dlerror = Cannot load library: load_library[1105]: Library 'libmmparser.so' not found

12-04 11:38:21.933: V/ExtendedExtractor(6916): Failed to open MM_PARSER_LITE_LIB, dlerror = Cannot load library: load_library[1105]: Library 'libmmparser_lite.so' not found"
Mobiius
Valued Member
16
Years of Service
User Offline
Joined: 27th Feb 2003
Location: The Cold North
Posted: 4th Dec 2011 18:27 Edited at: 4th Dec 2011 18:30
I've figured this out for my own project.

Here's my folder layout..


You need to ensure that both the Interpreter folder, and your project folder are in the same root folder. The assets folder goes in your project folder.

The project folder should be a copy & paste of the interpreter_android folder, with the manifest, and res folder items amended from within the project folder, and the interpreter.cpp file from the interpreter folder changes to uncomment the bytecode.byc line.

My signature is NOT a moderator plaything! Stop changing it!

Attachments

Login to view attachments
b83
7
Years of Service
User Offline
Joined: 30th Nov 2011
Location:
Posted: 4th Dec 2011 19:11
Thanks Mobiius, I appreciate it and will keep it in mind as I also had trouble with tier 1 builds with android but I am building for tier 2 which I believe doesn't need the interpreter? or am I wrong?

My build compiles successfully, installs and runs fine on my android device, it's just that no matter if I have a folder called 'assets' or 'media' with my image in it anywhere in my project's folder including the places where they should be, the image fails to load

12-04 12:55:05.324: E/native-activity(9199): Failed to load image media/back.png

this is after I added:

agk::SetCurrentDir( "media" );

I've also tried:

agk::SetCurrentDir( "assets" );

all files and folders are lowercase.

maybe something is wrong with my code?

Paul Johnston
TGC Developer
16
Years of Service
User Offline
Joined: 16th Nov 2002
Location: United Kingdom
Posted: 4th Dec 2011 22:39
media must be placed in the "assets" folder, and loaded from the root directory agk::SetCurrentDir( "" ); and is case sensitive.
b83
7
Years of Service
User Offline
Joined: 30th Nov 2011
Location:
Posted: 5th Dec 2011 00:00
It works! Thanks a ton Paul, very much appreciated!

Login to post a reply

Server time is: 2019-07-20 02:05:02
Your offset time is: 2019-07-20 02:05:02