本文介绍了谷歌玩游戏服务错误 - > “找不到类... GameHelper”的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

 进口com.google.example.games.basegameutils.GameHelper;
公共类MyAppName扩展Cocos2dxActivity实现GameHelper.GameHelperListener {
....
.....公共静态GameHelper gameHelper;@覆盖
保护无效的onCreate(捆绑savedInstanceState){
    super.onCreate(savedInstanceState);
    gameHelper =新GameHelper(本);
  .....

错误点: gameHelper =新GameHelper(本);

错误消息:找不到类的com.google.example.games.basegameutils.GameHelper,从法com.company.MyAppName.MyAppName.onCreate引用

我该如何解决这个问题?


解决方案

  1. 在BaseGameUtils,转至项目属性| Android系统。验证它是针对一个有效的Andr​​oid目标这是present你的SDK(任何与API级> = 8应该工作)。


  2. 此外在项目属性屏幕BaseGameUtils,检查是库复选框被选中。


  3. 检查BaseGameUtil是引用谷歌播放-services_lib作为库。 (项目属性| Android版|参考)


  4. 检查您的项目引用BaseGameUtil作为库(下同)。


希望这有助于!

import com.google.example.games.basegameutils.GameHelper;
public class MyAppName extends Cocos2dxActivity implements GameHelper.GameHelperListener {
....
.....

public static GameHelper gameHelper;

@Override
protected void onCreate(Bundle savedInstanceState){
    super.onCreate(savedInstanceState);
    gameHelper  = new GameHelper(this);
  .....

error point: gameHelper = new GameHelper(this);

error Message : Could not find class 'com.google.example.games.basegameutils.GameHelper', referenced from method com.company.MyAppName.MyAppName.onCreate

How do I fix this?

解决方案
  1. On BaseGameUtils, go to Project Properties | Android. Verify that it's targeting a valid Android target that's present on your SDK (anything with API level >= 8 should work).

  2. Also on the project properties screen for BaseGameUtils, check that the "Is Library" checkbox is checked.

  3. Check that BaseGameUtil is referencing google-play-services_lib as a library. (Project Properties | Android | References).

  4. Check that your project is referencing BaseGameUtil as a library (same).

Hope this helps!

这篇关于谷歌玩游戏服务错误 - > “找不到类... GameHelper”的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

06-16 21:11