AndEngine with Google Play game services

北慕城南 提交于 2019-12-07 03:54:54

问题


Im using AndEngine-GLES2-AnchorCenter and I want implement Google Play game services.

I copied BaseGameActivity and GameHelper classes from BaseGameUtils (part of Google Play game services - Android Samples) to my project in same util package.

Because AndEngine already use BaseGameActivity, I renamed it to GBaseGameActivity and changed extended class to BaseGameActivity (AndEngine class), so from this:

public abstract class BaseGameActivity extends FragmentActivity

to:

public abstract class GBaseGameActivity extends BaseGameActivity

Then I extended my class on GBaseGameActivity (when I extend BaseGameActivity(AndEngine class), its working ... but not with GBaseGameActivity(BaseGameUtils class) )

public class BaseActivity extends GBaseGameActivity

I tried compiled my project, but i got:

...
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

Where is problem?


回答1:


Problem was that google-play-services module scope was set to Provided instead of Compile.



来源:https://stackoverflow.com/questions/17199072/andengine-with-google-play-game-services

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!