Season
Season

Reputation: 1218

Android: cannot import BaseGameUtils successfully in Eclipse

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?

Upvotes: 3

Views: 3057

Answers (6)

n.by.n
n.by.n

Reputation: 2468

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

Upvotes: 0

Luan Nguyen
Luan Nguyen

Reputation: 11

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

Upvotes: 1

hayath
hayath

Reputation: 13

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 !

Upvotes: 1

Narek
Narek

Reputation: 39881

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)

Upvotes: 0

SEG.Veenstra
SEG.Veenstra

Reputation: 728

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.

Upvotes: 3

Season
Season

Reputation: 1218

Solved.

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

Upvotes: 2

Related Questions