Reputation: 3912
I am trying to implement the Google Play Game Services
leaderboard found here. I imported the library BaseGameUtils
, made it a library and added it to my main project. But there is a little red X and a red ! on my projects (see below picture).
Also, it says that the C:\Users\lyonsmg\Downloads\android-samples-master\BaseGameUtils\bin
is missing in my Android Dependencies for my main project, BibleTriviaLite
(see below picture).
What am I doing wrong? I was able to import the google-play-services_lib
correctly but not the BaseGameUtils
. How can I fix this?
Upvotes: 1
Views: 4035
Reputation: 1403
For me the problem was the google doc, imho. If i import a project , set it as lib, and add it as a reference to my code/project I would have never thought I would have to add it to compile path manually as well ( of course i want to compile it , no?) . Everything was set like above, I retested three times. Didn't work. BaseGameUtils would'n find the reference of com.google...gsm. Only if I manually add google play service library project to java build path under projects for the project BaseGameUtils it would a compile. (Eclipse 4.3.0)
from the short instructions by Google's github doc
If you're using Eclipse...
Import the desired sample (Project | Import | Android | Existing Android Source)
Import the Google Play Services library project (available for download through the SDK manager). Make sure that the sample is REFERENCING the library project (Project Properties | Android | References)
Upvotes: 0
Reputation: 5076
Check the project properties for BaseGameUtils. Go to Project Properties | Android and check that it's targeting a valid Android target (there should be exactly one target checked) that's API level >= 8.
Check that BaseGameUtils is referencing google-play-services_lib as a dependency. To do this, go to Project Properties | Android and look at the References section. If there is nothing there, add a reference to google-play-services_lib.
Check that both google-play-services_lib and BaseGameUtils are set up as library projects. Go to Project Settings | Android and verify that both have the "Is Library" checkbox checked.
Clean and rebuild everything.
Hope this helps!
Upvotes: 5
Reputation: 31
I was having the same problem and I think it was because you haven't added the google-play-service.jar to the BaseGameUtils project. I did this in eclipse by finding an error in the project, I used GamesClient in BaseGameActivity.java on the method getGamesClient() and hovered my mouse over GamesClient until the dropdown box appeared. I then clicked fix project setup. On the popup window click add google-play-service.jar (the 2nd one in the list) then click ok. This fixed the error for me. Hope it helps.
Upvotes: 1