AndEngine with Google Play Game Services

I am using AndEngine-GLES2-AnchorCenter and I want to implement Google Play services.

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

Since AndEngine already uses BaseGameActivity , I renamed it GBaseGameActivity and changed the extended class to BaseGameActivity (AndEngine class), so from this:

 public abstract class BaseGameActivity extends FragmentActivity 

in

 public abstract class GBaseGameActivity extends BaseGameActivity 

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

 public class BaseActivity extends GBaseGameActivity 

I tried to compile 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 the problem?

+6
source share
1 answer

The problem was that the google-play-services module area was set to Provided instead of Compile .

+3
source

Source: https://habr.com/ru/post/947677/


All Articles