AndEngine with Google Play game services
Asked Answered
B

1

6

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?

Backpedal answered 19/6, 2013 at 18:53 Comment(2)
Do you need to change the manifest file? ([see here for example][1]) [1]: stackoverflow.com/questions/16822493/android-couldnt-find-classBaskin
I have just 1 activity (BaseActivity) extended on GBaseGameActivity and GBaseGameActivity implements GameHelper, so I dont need register it to AndroidManifestBackpedal
B
3

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

Backpedal answered 20/6, 2013 at 15:50 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.