问题
I'm using Android Studio
and tried to import Google Play Game Services into my application.
Imported BaseGameUtils folder in the libraries and now I have an error at the following line, in the GameHelper class:
import com.google.android.gms.games.request.GameRequest;
More exactly, it says "cannot resolve symbol: request."
I'm pretty new to android development and android studio so sorry if it's a lousy question.
Edit 1
Ok, so i did what Scott Barta told me, but still got a "cannot resolve symbol: GameRequest."
.
On a simmilar topic i found that i should go to Project Structure -> modules -> dependencies -> plus sign -> module dependency and add my libraries file there as well.
Did that, and i got this:
"Gradle project refrsh failed: Cause: java.lang.StackOverflowError"
Other things i did was go to settings.gradle and add a
include ":libraries:BaseGameUtils"
In the build.gradle i added, in the dependencies tree
compile project(':libraries:BaseGameUtils')
回答1:
I just ran into the same problem. What fixed it for me was updating the google play-services to a newer version. Check your build.gradle file and see if it's using an older version in the dependencies. If so, try replacing it with
compile 'com.google.android.gms:play-services:4.3+'
回答2:
I'm not sure how you're including the Google Play Services library, but the correct way is:
- Ensure that the "Google Repository" is installed in the SDK manager
- File > Project Structure > Modules > Dependencies > + button > Library dependency,
then choose "Google Play Services" from the list.
回答3:
Try manually executing gradle from your app directory to get more information about what's going wrong.
./gradlew --info --stacktrace assembleDebug
来源:https://stackoverflow.com/questions/23113726/importing-games-request