This week's book giveaway is in the OCAJP 8 forum.
We're giving away four copies of OCA Java SE 8 Programmer I Study Guide and have Edward Finegan & Robert Liguori on-line!
See this thread for details.
The moose likes Android and the fly likes unhandled exception prevents my game from running Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of OCA Java SE 8 Programmer I Study Guide this week in the OCAJP 8 forum!
JavaRanch » Java Forums » Mobile » Android
Bookmark "unhandled exception prevents my game from running" Watch "unhandled exception prevents my game from running" New topic

unhandled exception prevents my game from running

John Nellany

Joined: Feb 29, 2012
Posts: 1
I used to be in college doing computer games development, I haven't programmed in years but recently something came up and I need to start again. Android really frustrates me I'm running some source code and i had it working but now there are errors once it runs and then the app crashes (emulator 4.0 and phone 2.1) and the project is set for 2.0 is that the issue? I assume backward compatability.

03-01 02:01:51.876: D/AndroidRuntime(7464): Shutting down VM
03-01 02:01:51.876: W/dalvikvm(7464): threadid=3: thread exiting with uncaught exception (group=0x40026160)
03-01 02:01:51.876: E/AndroidRuntime(7464): Uncaught handler: thread main exiting due to uncaught exception
03-01 02:01:51.876: E/AndroidRuntime(7464): java.lang.IllegalArgumentException: Supplied TextureSource must not exceed bounds of Texture.
03-01 02:01:51.876: E/AndroidRuntime(7464): at org.anddev.andengine.opengl.texture.Texture.checkTextureSourcePosition(
03-01 02:01:51.876: E/AndroidRuntime(7464): at org.anddev.andengine.opengl.texture.Texture.addTextureSource(
03-01 02:01:51.876: E/AndroidRuntime(7464): at org.anddev.andengine.opengl.texture.region.TextureRegionFactory.createFromSource(
03-01 02:01:51.876: E/AndroidRuntime(7464): at org.anddev.andengine.opengl.texture.region.TextureRegionFactory.createFromAsset(
03-01 02:01:51.876: E/AndroidRuntime(7464): at theHardestGame.pac.GameLogicController.onLoadResources(
03-01 02:01:51.876: E/AndroidRuntime(7464): at org.anddev.andengine.ui.activity.BaseGameActivity.doResume(
03-01 02:01:51.876: E/AndroidRuntime(7464): at org.anddev.andengine.ui.activity.BaseGameActivity.onWindowFocusChanged(
03-01 02:01:51.876: E/AndroidRuntime(7464): at$DecorView.onWindowFocusChanged(
03-01 02:01:51.876: E/AndroidRuntime(7464): at android.view.View.dispatchWindowFocusChanged(
03-01 02:01:51.876: E/AndroidRuntime(7464): at android.view.ViewGroup.dispatchWindowFocusChanged(
03-01 02:01:51.876: E/AndroidRuntime(7464): at android.view.ViewRoot.handleMessage(
03-01 02:01:51.876: E/AndroidRuntime(7464): at android.os.Handler.dispatchMessage(
03-01 02:01:51.876: E/AndroidRuntime(7464): at android.os.Looper.loop(
03-01 02:01:51.876: E/AndroidRuntime(7464): at
03-01 02:01:51.876: E/AndroidRuntime(7464): at java.lang.reflect.Method.invokeNative(Native Method)
03-01 02:01:51.876: E/AndroidRuntime(7464): at java.lang.reflect.Method.invoke(
03-01 02:01:51.876: E/AndroidRuntime(7464): at$
03-01 02:01:51.876: E/AndroidRuntime(7464): at
03-01 02:01:51.876: E/AndroidRuntime(7464): at dalvik.system.NativeStart.main(Native Method)
03-01 02:01:51.916: E/SemcCheckin(7464): Get crash dump level : /data/semc-checkin/crashdump

03-01 02:01:51.926: I/dalvikvm(7464): threadid=7: reacting to signal 3
03-01 02:01:51.926: I/dalvikvm(7464): Wrote stack trace to '/data/anr/traces.txt'

Thank you peter for the introduction,
You're help would be greatly appericated

I'm loading all my images to the screen onLoadResources

this.mMenuTexture = new Texture(256, 256, TextureOptions.BILINEAR_PREMULTIPLYALPHA);
this.mMenuResetTextureRegion = TextureRegionFactory.createFromAsset(this.mMenuTexture, this, "gfx/menuPlay.png", 0, 0);
this.mMenuQuitTextureRegion = TextureRegionFactory.createFromAsset(this.mMenuTexture, this, "gfx/menuQuit.png", 0, 50);
this.mMenuSettingsTextureRegion = TextureRegionFactory.createFromAsset(this.mMenuTexture, this, "gfx/menuSettings.png", 0, 100);

this.mSubMenuTexture = new Texture(256, 256, TextureOptions.BILINEAR_PREMULTIPLYALPHA);
this.mMenuOkTextureRegion = TextureRegionFactory.createFromAsset(this.mSubMenuTexture, this, "gfx/menuOk.png", 0, 0);
this.mMenuBackTextureRegion = TextureRegionFactory.createFromAsset(this.mSubMenuTexture, this, "gfx/menuBack.png", 0, 50);

this.mEnemyTexture = new Texture(64, 64, TextureOptions.BILINEAR_PREMULTIPLYALPHA);
enemyTextureRegion = TextureRegionFactory.createFromAsset(this.mEnemyTexture, this, "gfx/enemyA.png", 0, 0);


this.mEngine.registerUpdateHandler(new FPSLogger());
this.mEngine.getTextureManager().loadTextures(this.mLevelButtonDisabled,this.mLevelSignTextures, this.mMenuTexture, this.mSubMenuTexture, this.mTexture, this.mEnemyTexture, this.mFinishLineTexture, this.mBlockTexture, this.mDiamantTexture, this.mLevelMenuTexture
, this.mLevelChooseBackTexture, this.mLevelChooseMenuTexture, this.mLevelChooseNextTexture, this.mLevelTexture1, this.mBackgroundTexture);

Peter Johnson

Joined: May 14, 2008
Posts: 5852

John, welcome to Java Ranch!

It would have been better if you copied and pasted the text, rather than posting a screen shot. We need to see the rest of the exception that starts:

java.lang.IllegalArgumentExcpetion: Supplied TextureSource must not exceed...

Also, check what you are doing in theHardestGame.pac.GameLogicController.onLoadResources().

It would also help you to see the line numbers...

JBoss In Action
I agree. Here's the link:
subject: unhandled exception prevents my game from running
It's not a secret anymore!