Google Play游戏服务+ BaseGameUtils添加到Gradle project =包不存在 [英] Google Play Game Services + BaseGameUtils added to a Gradle project = package does not exist

查看:542
本文介绍了Google Play游戏服务+ BaseGameUtils添加到Gradle project =包不存在的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经阅读了许多关于这个问题的答案,但是无法解决我的问题,这里是:



我有一个毕业生项目,是一个游戏,那个游戏我想添加谷歌游戏服务,像我成功地使用'type-a-number'(这不是一个毕业的项目)。



但是我得到以下错误:

  Gradle:错误:package com.google.example.games.basegameutils不存在
Gradle:error :找不到符号类BaseGameActivity
Gradle:错误:找不到符号变量super

注意:在我的活动中,由于来自BaseGameUtils而发生红色的所有内容在以下情况之后变为正常:




  • 导入BaseGameUtils作为一个模块,将其作为模块依赖关系添加到我的项目中,并检查'​​library mobule'框。

  • 将google-play-services.jar作为库导入

  • 添加到我的build.gradle文件(我的modu中的一个) le root):

     依赖关系{
    compile'c​​om.android.support:support-v4:18.+'
    编译'com.google.android.gms:play-services:3. +'
    }

    ==>是否有可能在这里添加一个BaseGameUtils依赖?


  • 试图检查/取消选中BaseGameUtils依赖的导出框


  • 尝试将编译更改为提供

  • 更改settings.gradle到

      include':MyModule''(:libraries):BaseGameUtils'
    / pre>



(一次与:库,一次没有)



上面没有列出的工作..



我做错了什么?



'm missing?

解决方案

您的 settings.gradle 应该是: / p>

  include':MyModule',':BaseGameUtils'

请注意逗号。



build.gradle MyModule 也应该有

 依赖关系{
compile'c​​om.android.support:support -v4:18. +'
compile'c​​om.google.android.gms:play-services:3. +'
compile project(':BaseGameUtils')
}


I already read many answers on this subject but can't fix my problem, and here it is :

I have a gradle project that is a game, in that game I want to add google game services like I successfully did with 'type-a-number' (which is NOT a gradle project).

But I get the following error:

Gradle: error: package com.google.example.games.basegameutils does not exist
Gradle: error: cannot find symbol class BaseGameActivity
Gradle: error: cannot find symbol variable super

NOTE : in my activity everything that was red because of coming from BaseGameUtils change to normal after the following :

  • imported BaseGameUtils as a module, added it as a module dependency to my project and check the 'library mobule' box.
  • imported google-play-services.jar as a library
  • added to my build.gradle file (the one in my module root) :

    dependencies {
        compile 'com.android.support:support-v4:18.+'
        compile 'com.google.android.gms:play-services:3.+'
    }
    

    ==> Is there a possibility to add a BaseGameUtils dependencies here ?

  • tried to check/uncheck the export box of BaseGameUtils dependency

  • tried to change 'compile' to 'provided'
  • change the settings.gradle to

    include ':MyModule' '(:libraries):BaseGameUtils'
    

(one time with :libraries, one time without)

Nothing listed above worked..

What I'm doing wrong ?

What I'm missing ?

解决方案

Your settings.gradle should be:

include ':MyModule', ':BaseGameUtils'

Note the comma.

Your build.gradle for MyModule should also have

dependencies {
    compile 'com.android.support:support-v4:18.+'
    compile 'com.google.android.gms:play-services:3.+'
    compile project(':BaseGameUtils')
}

这篇关于Google Play游戏服务+ BaseGameUtils添加到Gradle project =包不存在的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆