Importing games.request

跟風遠走 提交于 2019-12-11 03:24:23

问题


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

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