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.

AppGameKit Classic Chat / AGK 2.21 Shader error causes crash in Adverts system when APK type set to Amazon

Author
Message
Wilf
Valued Member
17
Years of Service
User Offline
Joined: 1st Jun 2006
Location: Gone to Unity.
Posted: 17th Oct 2016 18:04 Edited at: 18th Oct 2016 15:30
AGK 2.21 crashes on Android if you call the advert system after loading a shader that doesn't exist or has a miss-spelled filename. The app displays a black screen for a long time after closing the ad; sometimes the advert content is corrupted with blocks of colour. Eventually the app will just exit.

The app resumes correctly if the .apk type is set to 'Google'

Good news: SetErrorMode(2) will catch the error but I missed it for a while because I was setting that after I'd tried to load the shader.
Setting Error Mode to 0 before trying to load a non-existent shader results in a message box that reads "Vertex shader failed to compile: 0:1: L0009: Missing main() function for shader."

Bad news: The crash is silent if you try to load the shader or ads before calling SetErrorMode(). Good thing we have GetLastError() otherwise I might not have found it. Bottom line: Have SetErrorMode() as one of the first lines in your code!

Media-free test code;
- Populate with your own ad credentials
- Export .apk with APK Type set to Amazon
- Run app and wait for "btnRed AdvertLoadedAdMob(): 0" to change to 1.
- Press the red rectangle to show the ad.
- Ad will display with graphics corruption; closing the ad results in a crash.

Attachments

Login to view attachments
Paul Johnston
TGC Developer
21
Years of Service
User Offline
Joined: 16th Nov 2002
Location: United Kingdom
Posted: 18th Oct 2016 15:04
Thanks, I'll add more checks on the shader loading code so it doesn't try to reload invalid shaders when returning to the app.
Wilf
Valued Member
17
Years of Service
User Offline
Joined: 1st Jun 2006
Location: Gone to Unity.
Posted: 19th Oct 2016 09:03
Groovy. While you're there - the original aspect ratio of the app isn't restored on return from the advert, so borders show at the top and bottom of the screen. Resetting the screen seems to get skipped if called right after showing the ad, so I have to run a timer and reset after 1 second or so. Clunky.
Paul Johnston
TGC Developer
21
Years of Service
User Offline
Joined: 16th Nov 2002
Location: United Kingdom
Posted: 19th Oct 2016 16:53
Quote: "the original aspect ratio of the app isn't restored on return from the advert, so borders show at the top and bottom of the screen"

I've not seen this happen before, do you have an example?
Wilf
Valued Member
17
Years of Service
User Offline
Joined: 1st Jun 2006
Location: Gone to Unity.
Posted: 2nd Nov 2016 19:22
Can't repro it with a stand alone program, so must be something I'm doing in my labyrinthine codebase. Sorry.

Login to post a reply

Server time is: 2024-04-26 12:58:53
Your offset time is: 2024-04-26 12:58:53