androidandenginegoogle-play-gamesandengine-gles-2

AndEngine with Google Play game services


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?


Solution

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