Font loading bug (minimal compilable code attached)

  ... discussions about development with the GLES2 branch of AndEngine.

Font loading bug (minimal compilable code attached)

Postby alexandernst » Sun Dec 25, 2011 10:18 pm

After searching for a good amount of time for a solution I came with the conclusion that the problem I'm having is not because of my code, and I wrote a little example project (~30 lines) so you can study it and, perhaps, tell me what's wrong with either my code or with AndEngine.

As you can see from the project, there are two activities (minimal setup, no customizations at all), and a Text in each one. Both texts use the same font, same size, same bitmap size, same color, etc... The only different thing is that the first one says "first" and the second one says "second" (both in lowercase).

Switching from the first to the second activity makes the whole application to crash.

I'll be really thankful if you could tell me why is that happening.

Regards
Attachments
fontstest.7z
(76.28 KiB) Downloaded 321 times
alexandernst
 
Posts: 28
Joined: Fri Dec 16, 2011 10:22 pm

Re: Font loading bug (minimal compilable code attached)

Postby jaym » Mon Dec 26, 2011 1:14 am

Post the error log and the code surrounding where the crash is taking place. You'll get a faster response.
AndEngine for Android Game Development Cookbook - Based on AndEngine's latest, greatest, GLES2.0 AnchorCenter branch!
jaym
 
Posts: 690
Joined: Wed May 04, 2011 10:08 pm

Re: Font loading bug (minimal compilable code attached)

Postby alexandernst » Mon Dec 26, 2011 1:17 am

Ok, well, the code is this one:

Syntax: [ Download ] [ Hide ]
Using java Syntax Highlighting
  1.                 FontFactory.setAssetBasePath("fonts/");
  2.                 ITexture ambulanceShotgunFontTexture = new BitmapTextureAtlas(256, 256, TextureOptions.BILINEAR);
  3.                 ambulanceShotgunFont = FontFactory.createFromAsset(ambulanceShotgunFontTexture, this, "ambulance shotgun.ttf", 48, true, Color.WHITE).load(getTextureManager(), getFontManager());
  4.  
Parsed in 0.015 seconds, using GeSHi 1.0.8.4


and this is the error log:

12-25 23:51:45.781: E/AndroidRuntime(10608): FATAL EXCEPTION: main
12-25 23:51:45.781: E/AndroidRuntime(10608): java.lang.NullPointerException
12-25 23:51:45.781: E/AndroidRuntime(10608): at org.andengine.ui.activity.BaseGameActivity.onResumeGame(BaseGameActivity.java:196)
12-25 23:51:45.781: E/AndroidRuntime(10608): at org.andengine.ui.activity.BaseGameActivity$4.run(BaseGameActivity.java:332)
12-25 23:51:45.781: E/AndroidRuntime(10608): at android.os.Handler.handleCallback(Handler.java:587)
12-25 23:51:45.781: E/AndroidRuntime(10608): at android.os.Handler.dispatchMessage(Handler.java:92)
12-25 23:51:45.781: E/AndroidRuntime(10608): at android.os.Looper.loop(Looper.java:130)
12-25 23:51:45.781: E/AndroidRuntime(10608): at android.app.ActivityThread.main(ActivityThread.java:3835)
12-25 23:51:45.781: E/AndroidRuntime(10608): at java.lang.reflect.Method.invokeNative(Native Method)
12-25 23:51:45.781: E/AndroidRuntime(10608): at java.lang.reflect.Method.invoke(Method.java:507)
12-25 23:51:45.781: E/AndroidRuntime(10608): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:847)
12-25 23:51:45.781: E/AndroidRuntime(10608): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:605)
12-25 23:51:45.781: E/AndroidRuntime(10608): at dalvik.system.NativeStart.main(Native Method)
alexandernst
 
Posts: 28
Joined: Fri Dec 16, 2011 10:22 pm

Re: Font loading bug (minimal compilable code attached)

Postby kimf » Mon Dec 26, 2011 1:35 am

Space in the file name, really? :o
kimf
 
Posts: 2
Joined: Fri Dec 23, 2011 2:40 pm

Re: Font loading bug (minimal compilable code attached)

Postby alexandernst » Mon Dec 26, 2011 1:37 am

Nope, as I said in the first post, this exact same code loads just fine the font and then renders the text in the first activity. But the second activity crashes because of that code! Why?
alexandernst
 
Posts: 28
Joined: Fri Dec 16, 2011 10:22 pm

Re: Font loading bug (minimal compilable code attached)

Postby alexandernst » Mon Dec 26, 2011 4:23 pm

Nobody? At least can you tell me if the bug is reproducible on other machines/phones too?
alexandernst
 
Posts: 28
Joined: Fri Dec 16, 2011 10:22 pm

Re: Font loading bug (minimal compilable code attached)

Postby Nicolas Gramlich » Mon Dec 26, 2011 7:24 pm

Hi,

the error seems to be on this line:

Syntax: [ Download ] [ Hide ]
Using java Syntax Highlighting
  1. this.mEngine.start();
Parsed in 0.012 seconds, using GeSHi 1.0.8.4


I assume there is something wrong with the lifecycle with continuous activities (which is ...very strange!).

Note: Haven't tried the code yet (no 7-zip on my macbook), so it might actually be something very different.

Best Regards,
Nicolas
Nicolas Gramlich
Site Admin
 
Posts: 1734
Joined: Mon Jun 07, 2010 6:20 pm
Location: Schriesheim, Germany

Re: Font loading bug (minimal compilable code attached)

Postby alexandernst » Mon Dec 26, 2011 7:29 pm

Sorry about that, thought 7z is standart format.
Here is the file using .zip
Attachments
fontstest.zip
(86.85 KiB) Downloaded 331 times
alexandernst
 
Posts: 28
Joined: Fri Dec 16, 2011 10:22 pm


Return to GLES2

Who is online

Users browsing this forum: No registered users and 37 guests