Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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?

like image 550
Shaddow Avatar asked Jun 19 '13 18:06

Shaddow


1 Answers

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

like image 61
Shaddow Avatar answered Sep 28 '22 13:09

Shaddow