AndEngine示例运行环境搭建过程

AndEngine的下载地址:https://github.com/nicolasgramlich

 

要想成功运行AndEngine的Examples必须下载的11个组件(包括Examples在内):

 

AndEngine:https://github.com/nicolasgramlich/AndEngine

 

AndEngine - Examples:https://github.com/nicolasgramlich/AndEngineExamples

 

AndEngine - Live-Wallpaper Extension:https://github.com/nicolasgramlich/AndEngineLiveWallpaperExtension

 

AndEngine - TexturePacker Extension:https://github.com/nicolasgramlich/AndEngineTexturePackerExtension

 

AndEngine - TMX Tiled Map Extension:https://github.com/nicolasgramlich/AndEngineTMXTiledMapExtension

 

AndEngine - Multiplayer Extension:https://github.com/nicolasgramlich/AndEngineMultiplayerExtension

 

AndEngine - Physics Box2D Extension:https://github.com/nicolasgramlich/AndEnginePhysicsBox2DExtension

 

AndEngine - SVGTextureRegion Extension:https://github.com/nicolasgramlich/AndEngineSVGTextureRegionExtension

 

AndEngine - .MOD-Player Extension:https://github.com/nicolasgramlich/AndEngineMODPlayerExtension

 

AndEngine - Augmented-Reality Extension:https://github.com/nicolasgramlich/AndEngineAugmentedRealityExtension

 

AndEngine - Scripting Extension:https://github.com/nicolasgramlich/AndEngineScriptingExtension

 

下载好后,将这些工程全部导入到eclipse中,因为所有工程默认的Android SDK target都是android-15所以大家最好事先下载好android SDK 4.0.3。

 

所有的工程都引用了AndEngine或者其他的组件。当编译有问题时,检查工程引用路径是否正确(在工程属性中选择Android,看下方的Library中的对应的路径是否正确)。

 

先编译AndEngine,然后编译各个扩展组件xxxxExtension,最后再编译Examples。

注意:编译过程有几个JAVA文件会出现“It is indirectly referenced from required .class file” 和“The hierarchy of the type is inconsistent”等问题,需要关闭项目,.classpath文件确保有以下路径

<?xml version="1.0" encoding="UTF-8"?>
<classpath>
	<classpathentry kind="con" path="com.android.ide.eclipse.adt.ANDROID_FRAMEWORK"/>
	<classpathentry kind="con" path="com.android.ide.eclipse.adt.LIBRARIES"/>
	<classpathentry kind="src" path="src"/>
	<classpathentry kind="src" path="gen"/>
	<classpathentry kind="output" path="bin/classes"/>
</classpath>

  ,再打开项目即可。

 

我在编译Examples时遇到了几处错误,分别进行了如下修改。如果各位同学在编译过程中没有遇到错误可以不必理会。

 

org.andengine.examples.HullAlgorithmExample.java文件中

 

import org.andengine.entity.primitive.vbo.Mesh;

改为

import org.andengine.entity.primitive.Mesh; 

 
org.andengine.examples.BoundCameraExample.java和org.andengine.examples.SplitScreenExample.java文件中

final AnimatedSprite face = new AnimatedSprite(pX, pY, this.mBoxFaceTextureRegion, this.getVertexBufferObjectManager()).animate(100);  

 

 

改为

 

    final AnimatedSprite face = new AnimatedSprite(pX, pY, this.mBoxFaceTextureRegion, this.getVertexBufferObjectManager());  
    face.animate(100);  

 

org.andengine.examples.TextBreakExample.java文件中

 

 

    this.mText = new Text(50, 40, this.mFont, "", 1000, new TextOptions(AutoWrap.LETTERS, AUTOWRAP_WIDTH, Text.LEADING_DEFAULT, HorizontalAlign.CENTER), vertexBufferObjectManager);  

改为

this.mText = new Text(50, 40, this.mFont, "", 1000, new TextOptions(AutoWrap.LETTERS, Text.LEADING_DEFAULT, HorizontalAlign.CENTER), vertexBufferObje

 

你可能感兴趣的:(AndEngine)