Question

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).

enter image description here

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).

enter image description here

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?

Était-ce utile?

La solution

  1. 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.

  2. 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.

  3. 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.

  4. Clean and rebuild everything.

Hope this helps!

Autres conseils

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.

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...

  1. Start Eclipse
  2. Import the desired sample (Project | Import | Android | Existing Android Source)

  3. 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)

  4. Import libraries/BaseGameUtils AS A LIBRARY Make sure that the sample is REFERENCING the library project (Project Properties | Android | References)
  5. Now jump to the Modify IDs, compile and run section and continue to follow the instructions there.
Licencié sous: CC-BY-SA avec attribution
Non affilié à StackOverflow
scroll top