Android: cannot import BaseGameUtils successfully in Eclipse

≯℡__Kan透↙ 提交于 2019-12-23 19:14:23

问题


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?


回答1:


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.




回答2:


Solved.

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




回答3:


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 !




回答4:


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




回答5:


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)




回答6:


This is the original Directory structure from this playgameservices github link

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

Change your BaseGameUtils project directory structure to this:

  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



来源:https://stackoverflow.com/questions/23948558/android-cannot-import-basegameutils-successfully-in-eclipse

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!