3

I want to use game api in my android project.

And I get started by following the instructions described in Google Site (the part - Setting up your game project) from the following link. https://developers.google.com/games/services/android/init

I have downloaded the library BaseGameUtils from this link https://github.com/playgameservices/android-samples

Then I import it as a project as described in instruction.

However, what I've got is a project named main but not BaseGameUtils.

And then I cannot called its BaseGameActivity in my android project.

How can I solve it?

Season
  • 1,178
  • 2
  • 22
  • 42

6 Answers6

3

Same issue solved differently.

I've imported the BaseGameUtils project and also couldn't refer to it. If you right-click the BaseGameUtils project that you've just imported and then go to properties > android and check "is library" you are able to refer to it in your app project.

SEG.Veenstra
  • 718
  • 1
  • 7
  • 18
2

Solved.

When importing project, not to select BaseGameUtils folder, but the root folder 'android-samples-master'. Then check the project named BaseGameUtils.

Season
  • 1,178
  • 2
  • 22
  • 42
1

This worked for me:

Download code from github, https://github.com/playgameservices/android-basic-samples In the downloaded folder copy the files from

android-basic-samples-master\BasicSamples\libraries\BaseGameUtils\src\main\java

to

android-basic-samples-master\BasicSamples\libraries\BaseGameUtils\src\main\src

Now import android-basic-samples-master as an android project.

Choose only BaseGameUtils , you'll get a project called main, right click project > properties > android Add library and select google-play-services_lib and also tick isLibrary and OK.

Also add an external jar android-support-v4.jar by right clicking project > properties > Java Build Path > Add external Jar .

Now add this project named main to your actual project as a library. TADA !

hayath
  • 13
  • 5
1

SOLVED.

You must follow: From the command line run Scripts/make_eclipse_compat (or Scripts/make_eclipse_compat.cmd on Windows). This creates the directory structure needed to import the projects correctly. Attention: android-basic-samples-master > Script/make_eclipse_compat.cmd

Ref: https://github.com/playgameservices/android-basic-samples

0

Adding to SEG.Veenstra's answer "....just imported and then go to properties > android and check "is library" you are able to refer to it in your app project" this link as there are problems in Google's documentation: Android Play Services Leaderboard cannot be installed (BaseGameUtils)

Community
  • 1
  • 1
Narek
  • 38,779
  • 79
  • 233
  • 389
0

This is the original Directory structure from this playgameservices github link

android-basic-samples->BasicSamples->libraries->BaseGameUtils->

enter image description here

Change your BaseGameUtils project directory structure to this:

enter image description here

  1. Now try importing this BaseGameUtils project into your Eclipse workspace.
  2. Right Click on BaseGameUtils project->properties->Android->Check Is Library
  3. Right Click on "YourProject"->properties->Android->Add->BaseGameUtils

Apply & OK.

Now BaseGameUtils is linked with your project

n.by.n
  • 2,458
  • 22
  • 31