Reputation: 39881
I follow https://developers.google.com/games/services/android/init to setup leaderboards. So in my game project I have setup google_play_services lib as it already uses AdMob. Now I need to all Also BaseGameUtils. But the steps in section "Setting up your game project" in the link above don't work. Let me tell what I have done:
BasicSamples/libraries/BaseGameUtils/src/main
which was added in my project as main
and not as BaseGameUtils
. main
project, in Properties->Android
section selected Is Library
and in my game project in Properties->Android
section added Reference to main
library. (Note that if you don't select Is Library
you cannot do 6. In the Library panel, click the Add button. 7.Select BaseGameUtils.
step as it is pointed out in the tutorial )import gms.common.api.*; import com.google.example.games.basegameutils.BaseGameActivity; public class MyGameActivity extends BaseGameActivity {
but neither of the imports is recognized. How to setup this? This should have been to be so easy but is it so creapy?
Upvotes: 1
Views: 2455
Reputation: 1249
For MAC users.
Open Terminal.
cd android-basic-samples
then type bash Scripts/make_eclipse_compat
It will generate eclipse_compat folder next to the Scripts folder. Import to Eclipse the generated folder.
Upvotes: 0
Reputation: 39881
The steps are incomplete in the tutorial. Here are the actual steps:
Opened https://github.com/playgameservices/android-basic-samples and pressed "Download ZIP" or you can clone the git repo too.
Then there is a Scripts/make_eclipse_compat
(.cmd for Windows) script. cd android-basic-samples;
and run the script. It generates eclipse_compat
next to Scripts
dir.
Import into eclipse android-basic-samples/eclipse_compat/libraries/BaseGameUtils
and not the original BaseGameUtils
downloaded. Note that in this case in Eclipse you are not getting add there main
project but a project called BaseGameUtils
.
Right click on BaseGameUtils
project go to Properties->Android
and make sure Is Library
is checked and add google_play_services
as Reference library.
If you use for example Facebook SDK or other SDKs then you may have such a conflict:
Found 2 versions of android-support-v4.jar in the dependency list, but not all the versions are identical (check is based on SHA-1........
Here is the resolution: Facebook SDK for Android duplicate support library on dependencies
Also
import gms.common.api.*;
is wrong you should do this:
import com.google.android.gms.common.api.*;
import com.google.example.games.basegameutils.BaseGameActivity;
public class MyGameActivity extends BaseGameActivity {
Upvotes: 7