cannot be cast to org.andengine.entity.shape.IAreaShape

  ... in the unlikely case you discovered a bug, post it here.

cannot be cast to org.andengine.entity.shape.IAreaShape

Postby sumeyra » Sat May 31, 2014 1:56 pm

When I run the project , I'm having trouble with this error :

05-30 10:45:25.553: E/AndroidRuntime(1590): FATAL EXCEPTION: UpdateThread
05-30 10:45:25.553: E/AndroidRuntime(1590): Process: com.brekol, PID: 1590
05-30 10:45:25.553: E/AndroidRuntime(1590): org.andengine.util.level.exception.LevelLoaderException: java.lang.ClassCastException:
org.andengine.entity.sprite.Sprite cannot be cast to org.andengine.entity.shape.IAreaShape
05-30 10:45:25.553: E/AndroidRuntime(1590): at org.andengine.util.level.LevelLoader.loadLevelFromStream(LevelLoader.java:127)
05-30 10:45:25.553: E/AndroidRuntime(1590): at org.andengine.util.level.LevelLoader.loadLevelFromAsset(LevelLoader.java:97)
05-30 10:45:25.553: E/AndroidRuntime(1590): at org.andengine.util.level.LevelLoader.loadLevelFromAsset(LevelLoader.java:88)
05-30 10:45:25.553: E/AndroidRuntime(1590): at org.andengine.util.level.LevelLoader.loadLevelFromAsset(LevelLoader.java:82)
05-30 10:45:25.553: E/AndroidRuntime(1590): at com.brekol.scene.GameScene.loadLevel(GameScene.java:216)
05-30 10:45:25.553: E/AndroidRuntime(1590): at com.brekol.scene.GameScene.createScene(GameScene.java:75)
05-30 10:45:25.553: E/AndroidRuntime(1590): at com.brekol.scene.BaseScene.<init>(BaseScene.java:30)
05-30 10:45:25.553: E/AndroidRuntime(1590): at com.brekol.scene.GameScene.<init>(GameScene.java:44)
05-30 10:45:25.553: E/AndroidRuntime(1590): at com.brekol.manager.SceneManager$1.onTimePassed(SceneManager.java:75)
05-30 10:45:25.553: E/AndroidRuntime(1590): at org.andengine.engine.handler.timer.TimerHandler.onUpdate(TimerHandler.java:94)
05-30 10:45:25.553: E/AndroidRuntime(1590): at org.andengine.engine.handler.UpdateHandlerList.onUpdate(UpdateHandlerList.java:47)
05-30 10:45:25.553: E/AndroidRuntime(1590): at org.andengine.engine.Engine.onUpdateUpdateHandlers(Engine.java:618)
05-30 10:45:25.553: E/AndroidRuntime(1590): at org.andengine.engine.Engine.onUpdate(Engine.java:605)
05-30 10:45:25.553: E/AndroidRuntime(1590): at org.andengine.engine.LimitedFPSEngine.onUpdate(LimitedFPSEngine.java:57)
05-30 10:45:25.553: E/AndroidRuntime(1590): at org.andengine.engine.Engine.onTickUpdate(Engine.java:568)
05-30 10:45:25.553: E/AndroidRuntime(1590): at org.andengine.engine.Engine$UpdateThread.run(Engine.java:858)
05-30 10:45:25.553: E/AndroidRuntime(1590): Caused by: java.lang.ClassCastException: org.andengine.entity.sprite.Sprite cannot be cast to org.andengine.entity.shape.IAreaShape
05-30 10:45:25.553: E/AndroidRuntime(1590): at com.brekol.scene.GameScene$2.onLoadEntity(GameScene.java:152)
05-30 10:45:25.553: E/AndroidRuntime(1590): at com.brekol.scene.GameScene$2.onLoadEntity(GameScene.java:1)
05-30 10:45:25.553: E/AndroidRuntime(1590): at org.andengine.util.level.LevelLoaderContentHandler.startElement(LevelLoaderContentHandler.java:82)
05-30 10:45:25.553: E/AndroidRuntime(1590): at org.apache.harmony.xml.ExpatParser.startElement(ExpatParser.java:143)
05-30 10:45:25.553: E/AndroidRuntime(1590): at org.apache.harmony.xml.ExpatParser.appendBytes(Native Method)
05-30 10:45:25.553: E/AndroidRuntime(1590): at org.apache.harmony.xml.ExpatParser.parseFragment(ExpatParser.java:513)
05-30 10:45:25.553: E/AndroidRuntime(1590): at org.apache.harmony.xml.ExpatParser.parseDocument(ExpatParser.java:474)
05-30 10:45:25.553: E/AndroidRuntime(1590): at org.apache.harmony.xml.ExpatReader.parse(ExpatReader.java:316)
05-30 10:45:25.553: E/AndroidRuntime(1590): at org.apache.harmony.xml.ExpatReader.parse(ExpatReader.java:279)
05-30 10:45:25.553: E/AndroidRuntime(1590): at org.andengine.util.level.LevelLoader.loadLevelFromStream(LevelLoader.java:123)
05-30 10:45:25.553: E/AndroidRuntime(1590): ... 15 more

PLEASE HELP ME !!! :oops:
sumeyra
 
Posts: 2
Joined: Wed May 28, 2014 10:41 am

Re: cannot be cast to org.andengine.entity.shape.IAreaShape

Postby msuzer » Sat Jun 07, 2014 3:02 pm

Sumeyra, please do the following corrections:

Reason: You are using a mix of old and new pre-built libraries, and you misconfigured your application build path.

Solution:

1. Download the source of GLES2 and PhysicsBox2DExtension and import them into your eclipse workspace as projects
1.1. Link for GLES2: https://github.com/nicolasgramlich/AndE ... Center.zip
1.2. Link for PhysicsBox2D: https://github.com/nicolasgramlich/AndE ... Center.zip

2. remove jar references from your Main Project (Your own project, not the one you just imported) build path: andengine-gles2-anchorcenter.jar, andenginephysicsbox2dextension.jar (you may also delete the jar files from the lib folder)

3. delete .so files related to those libraries listed above, under your Main Project's "libs" folder

4. Open your project properties, click on "Android" from the left pane, click "Add" button placed at the right of where the "Library" label located and Add your both imported projects to the list

5. remove all IAreaShape casts from your source code (where they look like (IAreaShape)someobject )

6. Build and Enjoy :)
msuzer
 
Posts: 1
Joined: Sat Jun 07, 2014 2:45 pm


Return to Bugs

Who is online

Users browsing this forum: No registered users and 2 guests