AndEngine与谷歌玩游戏服务 [英] AndEngine with Google Play game services
问题描述
使用im AndEngine-GLES2-AnchorCenter,我想实现谷歌玩游戏服务。
Im using AndEngine-GLES2-AnchorCenter and I want implement Google Play game services.
我复制 BaseGameActivity
和 GameHelper
从 BaseGameUtils
班(谷歌的一部分,玩游戏服务 - Android的样品)。我在同一个 UTIL
包项目
I copied BaseGameActivity
and GameHelper
classes from BaseGameUtils
(part of Google Play game services - Android Samples) to my project in same util
package.
由于AndEngine已经使用了 BaseGameActivity
,我改名为 GBaseGameActivity
并改变扩展类BaseGameActivity(AndEngine类) ,所以从这样的:
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
到
public abstract class GBaseGameActivity extends BaseGameActivity
然后我伸出我的课上 GBaseGameActivity
(当我向BaseGameActivity(AndEngine类),它的工作......但不与GBaseGameActivity(BaseGameUtils类))
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:
GBaseGameActivity.java:63:
63| mHelper = new GameHelper(this);
BaseActivity.java:35:
BaseActivity.java:35:
35| public class BaseActivity extends GBaseGameActivity
在哪里的问题?
Where is problem?
推荐答案
问题是,谷歌播放服务
模块范围设置为提供
而不是编译
。
Problem was that google-play-services
module scope was set to Provided
instead of Compile
.
这篇关于AndEngine与谷歌玩游戏服务的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!