简体   繁体   English

AndEngine与Google Play游戏服务

[英]AndEngine with Google Play game services

Im using AndEngine-GLES2-AnchorCenter and I want implement Google Play game services. 我使用AndEngine-GLES2-AnchorCenter,我希望实现Google Play游戏服务。

I copied BaseGameActivity and GameHelper classes from BaseGameUtils (part of Google Play game services - Android Samples) to my project in same util package. 我复制BaseGameActivityGameHelper从类BaseGameUtils (谷歌的Play游戏服务的一部分- Android电子样本)我在同一个项目中util包。

Because AndEngine already use BaseGameActivity , I renamed it to GBaseGameActivity and changed extended class to BaseGameActivity (AndEngine class), so from this: 因为AndEngine已经使用了BaseGameActivity ,我将它重命名为GBaseGameActivity并将扩展类更改为BaseGameActivity(AndEngine类),所以从这里:

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) ) 然后我在GBaseGameActivity上扩展了我的类(当我扩展BaseGameActivity(AndEngine类)时,它的工作......但不是GBaseGameActivity(BaseGameUtils类))

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: GBaseGameActivity.java:63:

63| mHelper = new GameHelper(this);

BaseActivity.java:35: BaseActivity.java:35:

35| public class BaseActivity extends GBaseGameActivity

Where is problem? 哪里有问题?

问题是google-play-services模块范围设置为Provided而不是Compile

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM