AndEngine与Google Play游戏服务

时间:2013-06-19 18:53:01

标签: android andengine google-play-games andengine-gles-2

我正在使用AndEngine-GLES2-AnchorCenter,我希望实施Google Play游戏服务。

我将BaseGameActivity(Google Play游戏服务的一部分 - Android示例)中的GameHelperBaseGameUtils类复制到同一个util包中的项目中。

因为AndEngine已经使用BaseGameActivity,我将其重命名为GBaseGameActivity并将扩展类更改为BaseGameActivity(AndEngine类),所以从这里:

public abstract class BaseGameActivity extends FragmentActivity

为:

public abstract class GBaseGameActivity extends BaseGameActivity

然后我在GBaseGameActivity上扩展了我的课程(当我扩展BaseGameActivity(AndEngine类)时,它的工作......但没有使用GBaseGameActivity(BaseGameUtils类))

public class BaseActivity extends GBaseGameActivity

我尝试编译我的项目,但我得到了:

...
Could not find class 'com.xxx.xxx.util.GameHelper', referenced from method com.xxx.xxx.util.GBaseGameActivity.<init>
Could not find class 'com.xxx.xxx.util.GameHelper', referenced from method com.xxx.xxx.util.GBaseGameActivity.onCreate
FATAL EXCEPTION: main
    java.lang.NoClassDefFoundError: com.xxx.xxx.util.GameHelper
    at com.xxx.xxx.util.GBaseGameActivity.<init>(GBaseGameActivity.java:63)
    at com.xxx.xxx.BaseActivity.<init>(BaseActivity.java:35)
...

GBaseGameActivity.java:63:

63| mHelper = new GameHelper(this);

BaseActivity.java:35:

35| public class BaseActivity extends GBaseGameActivity

问题在哪里?

1 个答案:

答案 0 :(得分:3)

问题是google-play-services模块范围设置为Provided而不是Compile