google play game service error -> 'Could not find class…GameHelper '

岁酱吖の 提交于 2019-12-25 16:42:28

问题


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:


  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!




回答2:


Did you define Basegameutils as a library project and include it as a reference ?

The doc that accompanies the sample is fairly good.




回答3:


In the latest BaseGameUtils project (I downloaded from google github on Aug 13, 2014), the source files are not under the src/ folder. so you will need to Properties->Java Build Path->Add folder and select the java folders.

If the project then compiles without error for the BaseGameUtils, great! I also encountered some other compilation errors and solved it by update the Google Play services to the latest version in SDK manager.

Hope it helps.



来源:https://stackoverflow.com/questions/16850668/google-play-game-service-error-could-not-find-class-gamehelper

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!