Domanda

as many people I'm trying to follow this tutorial without success. The simple error is:

The import com.google.example.games.basegameutils.BaseGameActivity cannot be resolved

BaseGameUtils is set as library and it imports the google-play-services without errors. My test project imports the BaseGameUtils library without errors, infact if I try to import the generic library I have no error

import com.google.example.games.basegameutils.*; -> no error!

In the folder

workspace\BaseGameUtils\gen\com\google\example\games\basegameutils

there are only two files: BuildConfig.java and R.java. The BaseGameActivity.java file is present only in the folder

workspace\BaseGameUtils\java\com\google\example\games\basegameutils

with other two files GameHelper.java and GameHelperUtils.java.

How can I resolve the problem? A simple Clean -> Build has no effect. Thank you

.: EDIT :.

Here a screen of the situation

È stato utile?

Soluzione

You need to use BaseGameUtils located at eclipse_compat/libraries/BaseGameUtils instead of BasicSamples/libraries/BaseGameUtils. Since the eclipse_compat directory is no more available in the github site, I've shared it here.

Altri suggerimenti

BaseGameActivity is not official from Google in order to use you need to copy its Source to your project. Please notice that the name of package declares its an "Example".

The eclipse_compat folder is not directly available, it needs to be generated via a provided script. Refer to the section "If you're using Eclipse..." located on the main page of the "android-basic-samples" project.

To summarize it:

  1. Download the android-basic-samples project from GitHub
  2. Unpack it and navigate to the "android-basic-samples-master" folder
  3. From this folder, run the command Scripts/make_eclipse_compat

Once done, follow these steps in Eclipse:

  1. File -> Import -> Existing Android Code Into Workspace
  2. Navigate to the "android-basic-samples-master\eclipse_compat\libraries" folder and select the "BaseGameUtils" folder
  3. Optionally, select "Copy projects into workspace" and click Finish
  4. Right click on the imported project, select Properties -> Android and select the "is Library" option
  5. Within the same dialog, click the Add button to reference the "google-play-services_lib" project
  6. Click OK to confirm, the project should be ready to use
  7. Right click on your project -> Properties -> Android -> click the Add button to reference the imported project in your project

It appears my issue likely is that I am using Eclipse. I need to use the eclipse_compat folder and use a different BaseGameUtils. However on the github site where they host the code, they removed that folder.

They suggest using Android Studio instead, I'm just not ready to migrate there yet. Does anyone have a copy of the BaseGameUtils for Eclipse?

You can have the eclipse_compat from current github. It is generated when you run a script that comes packaged (unzip the github file, then run Scripts/make_eclipse_compat).

ozbek
yes this worked,
Yeah, I think I solved the issue. (Right click your project -> Properties -> Java Build Path -> Projects tab -> Add -> BaseGameUtils).

Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow
scroll top