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 / really weird Tier2 1076 Image loading problem

Author
Message
erebusman
12
Years of Service
User Offline
Joined: 23rd Jul 2011
Location: Sacramento, CA
Posted: 6th Mar 2013 07:13
Hello,

I've been having a really difficult Tier 2 Android AppGameKit 1076 image loading problem.

So what's happening is that regular images won't load (they get the checkerboard RED X ) but atlas images load fine.

All the images are in the same folder assets/media

So here is some clips from my actual app

image that does *NOT* work



images that *DO* work



Additional things I checked

- triple verified case SENSiTiviTY of the file names and paths
- tried changing them all to .PNG's (since the atlas image was a .png I thought there might be something to it but no..)
- tried moving images to the /assets/ folder rather than /assets/media/
- used the agk::SetCurrentDir(""); to set both "" and "/media" (different attempts) , and with both variants moved files between the assets and media folder
- changed the image path in case it was / vs \ problem from "media/lucksplash.jpg" to "media\lucksplash.jpg"; same problem
- placed the images in BOTH locations /assets and /assets/media
- my image is 640x960 so I changed it to 640x1024 in case something was not liked about the 960 size
- resized the image to 320x480
- totally rebuilt the project from Ancient Lady's Wiki 1076 template ( using the 1076 default as a base then copying in her files)
- used the base 1076 template and rebuilt it twice also



Any help, advice, or things to check that I've missed greatly appreciated!

Thanks

erebusman
12
Years of Service
User Offline
Joined: 23rd Jul 2011
Location: Sacramento, CA
Posted: 6th Mar 2013 07:29
I'll note also : I recently reformatted my system and reinstalled ( had a potential virus threat so I didn't want to risk not being sure... )

I suspect there's a chance this is a result of my versions of one or more components being "too recent" possibly?

JDK 1.7 update 15
Eclipse Classic 4.2.2
NDK r8d
Win 7 64 bit
AGK 1076
Ancient Lady's 1076 android template from the AppGameKit Community wiki

easter bunny
11
Years of Service
User Offline
Joined: 20th Nov 2012
Playing: Dota 2
Posted: 7th Mar 2013 01:23
I use T1, so I'm not sure if this'll work....
But try using png's for everything (jpg's don't always work for me)
'/'s work fine for me on T1
use LoadImage(1,"asdf.png") not LoadImage(1,"media/asdf.png")
then put the media in assets/media/asdf.png
If this doesn't work, maybe try updating to the latest beta (1.08B8)
it's fairly stable, I've published a project compiled with it. (and it's never crashed)

There are 10 types of people, those who understand binary and those who don't
http://splatstudio.joshwebsites.com/
erebusman
12
Years of Service
User Offline
Joined: 23rd Jul 2011
Location: Sacramento, CA
Posted: 7th Mar 2013 01:38
Thanks for the suggestion MissJoJo

I did try .PNG's and I did try with and without the media in the name however I did not try both at the same time; so I'll try that out tonight when I get home .. something has to work eventually!

If anyone else comes up with ideas let me know I wont get home for a couple of hours still!

erebusman
12
Years of Service
User Offline
Joined: 23rd Jul 2011
Location: Sacramento, CA
Posted: 7th Mar 2013 05:51
Well 1088 doesnt work .. it wont compile with permission errors.


The fix Ancient Lady has for the chmod and chown doesnt fix it. (not blaming Ancient Lady at all just saying she has a fix that works for her she shared and it doesnt work for me)

I've been trying to get an Android app for .. almost a year now and getting to the point where I think I would have better results if I just learn Java and do it native.

Ancient Lady
Valued Member
20
Years of Service
User Offline
Joined: 17th Mar 2004
Location: Anchorage, Alaska, USA
Posted: 7th Mar 2013 16:15
The v1088 set came with a Windows batch file that can be run from the File Manager that will compile the project (as long as the name/path for the ndk stuff is correct). This should get by the permissions issue.

This post has information about that.

Cheers,
Ancient Lady
AGK Community Tester and AppGameKit Master
erebusman
12
Years of Service
User Offline
Joined: 23rd Jul 2011
Location: Sacramento, CA
Posted: 7th Mar 2013 21:05
Thanks ancient lady I can try that...

I should note: my project compiles, the game plays, most images load ... Just not all of them like the example I posted .

I'm unclear how the compile script will change whatever is going wrong with the image loading process but glad to try anything out.. Ill update post once vice tried that

Ancient Lady
Valued Member
20
Years of Service
User Offline
Joined: 17th Mar 2004
Location: Anchorage, Alaska, USA
Posted: 7th Mar 2013 21:50
I was responding to your post starting with "Well 1088 doesnt work .. it wont compile with permission errors."

As for the images, definitely go with .png files. I always fully reference my media files as "/media/<whatever>" (forward slash on both sides of the 'media').

When you converted the .jpg file to .png, did you make sure to put it in the assets/media directory, clean and build the project AND refresh it in Eclipse?

Eclipse doesn't automagically pick up any changes in the project directories, you need to tell it. You refresh each project by selecting in the project manager in Eclipse and hitting the F5 key (or use 'Refresh' from the right mouse pop-up menu). And you get no feedback from Eclipse when it refreshes.

Cheers,
Ancient Lady
AGK Community Tester and AppGameKit Master
erebusman
12
Years of Service
User Offline
Joined: 23rd Jul 2011
Location: Sacramento, CA
Posted: 7th Mar 2013 23:23
@Ancient Lady: Ah okay sorry I didn't realize which item you were responding to regarding that line my appologies.

I always close eclipse while Im making changes to my project, recompile it with cygwin and then re-open eclipse.

Because eclipse doesnt give me feedback I prefer that approach than the F5 otherwise I find myself mashing F5 a lot and I start feeling OCD you know?

I feel like this works becuase when I re-launch Eclipse and check the project explorer and check the assets folder anything I've changed is there.

I have tried every combination of file name/path I could think of. I've rebuilt the project over 32 times.

/media/myfile.jpg
media/myfile.jpg
myfile.jpg
\myfile.jpg
\media\myfile.jpg

and all those variants with .png files also

I have a new suspect I came up with while at work today.

I am loading some of these images in the Begin function (the splash one I quoted particuarly) I wonder if that is part of the problem?

the order I do it is;

1: load the splash image
2: create the sprite for splash
3: call a loadimages() function to load the rest of the images
4: once loadimages returns then delete the splash
5: continue forward to the App loop
6: in the app loop I create the sprites for the other images loaded in loadimages()

So maybe something about Begin loop cant load images and create sprites properly? /shrug

Ancient Lady
Valued Member
20
Years of Service
User Offline
Joined: 17th Mar 2004
Location: Anchorage, Alaska, USA
Posted: 8th Mar 2013 04:05
Nothing updates in the Begin method.

You can only update displays once that is complete.

I start my splash in the Begin method (call to another function) and leave it up with a flag and a timer.

In the Loop method, I check the flag, if set then I check the timer. If the timer has elapsed, then I delete the sprite and image for the splash and continue with normal processing.

So, if you are deleting the image in the Begin method, you are right, that might be the culprit.

Cheers,
Ancient Lady
AGK Community Tester and AppGameKit Master
erebusman
12
Years of Service
User Offline
Joined: 23rd Jul 2011
Location: Sacramento, CA
Posted: 8th Mar 2013 06:01 Edited at: 8th Mar 2013 07:23
Created a test program that demonstrates my problem.

Images attached in zip file.

The theory I came up with at work did not pan out, this sample code does not use the Begin loop to load any images and it also does not work.



I should note I played with the slashes several ways and had the same problem. If anyone can try this out and if you notice what the problem is I'd appreciate it greatly

Attachments

Login to view attachments
Ancient Lady
Valued Member
20
Years of Service
User Offline
Joined: 17th Mar 2004
Location: Anchorage, Alaska, USA
Posted: 8th Mar 2013 16:20 Edited at: 8th Mar 2013 16:21
Your process doesn't quite work because you load and delete the images before the Sync has been done.

It takes at least one Sync cycle (and sometimes two) before you see the first output.

Call the loadApp in the app::Begin method.

Then, don't delete the image and sprite until you change the loadFlag to one.

Try this:


The way you were doing is has the app calling loadApp(), then deleting the image and sprite, every sync cycle for 3 seconds and never allowing the image to display.

Cheers,
Ancient Lady
AGK Community Tester and AppGameKit Master
erebusman
12
Years of Service
User Offline
Joined: 23rd Jul 2011
Location: Sacramento, CA
Posted: 8th Mar 2013 17:00
Thanks Ancient Lady I'll try that out tonight when I get home.

Hopefully what I wrote in this sample program is similar enough to my real program that its the same problem. I had to clip a lot of stuff out to make a small shareable sample program. Crossing my fingers!

erebusman
12
Years of Service
User Offline
Joined: 23rd Jul 2011
Location: Sacramento, CA
Posted: 9th Mar 2013 03:40 Edited at: 9th Mar 2013 03:48
Ok so I adjusted that bit of code ancient lady ; still have the same problem.

Also my main app doesn't work like that I made an error; the delete sprite should have been nested inside the myTimer loop like so:



Ancient Lady
Valued Member
20
Years of Service
User Offline
Joined: 17th Mar 2004
Location: Anchorage, Alaska, USA
Posted: 9th Mar 2013 04:10
Move the call to loadApp() into the Begin method. The way you have it now, it keeps executing and the myTimer value keeps getting reset and never expires.

Cheers,
Ancient Lady
AGK Community Tester and AppGameKit Master
erebusman
12
Years of Service
User Offline
Joined: 23rd Jul 2011
Location: Sacramento, CA
Posted: 9th Mar 2013 05:01
Oops ; okay good spot.

Trying that now.

erebusman
12
Years of Service
User Offline
Joined: 23rd Jul 2011
Location: Sacramento, CA
Posted: 9th Mar 2013 05:08
Okay ; so I moved the loop as suggested and it still did not work.

Then I changed over to a .png instead of a .jpg and then it did work.

So I'm going to try and reverse engineer what was broken about my example and see which of those items I can fix in my main project.

I'm confused now because my main app works on PC & iOS .. there must be something a little tricky somewhere that behaves differently.

It would be good to know what that is so we can document it and avoid it

Ancient Lady I owe you a graphic at this point. Hit me up when you want some work done and I'll do my best to help you out!

Ancient Lady
Valued Member
20
Years of Service
User Offline
Joined: 17th Mar 2004
Location: Anchorage, Alaska, USA
Posted: 9th Mar 2013 17:11
Android doesn't do .jpg (apparently) which is why it works in other platforms and not Android.

Thank you for the offer, I might take you up on it someday.

Good luck and Happy Programming going forward.

Cheers,
Ancient Lady
AGK Community Tester and AppGameKit Master
erebusman
12
Years of Service
User Offline
Joined: 23rd Jul 2011
Location: Sacramento, CA
Posted: 12th Mar 2013 16:03
Drop me a line at gmail , same username as my forum name when you need something!

Login to post a reply

Server time is: 2024-04-20 12:02:43
Your offset time is: 2024-04-20 12:02:43