6
votes

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
Do you need to change the manifest file? ([see here for example][1]) [1]: stackoverflow.com/questions/16822493/android-couldnt-find-classAl Lelopath
I have just 1 activity (BaseActivity) extended on GBaseGameActivity and GBaseGameActivity implements GameHelper, so I dont need register it to AndroidManifestShaddow

1 Answers

3
votes

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