在IntelliJ中导入“google-play-services_lib”时出错

时间:2013-12-27 04:08:39

标签: android intellij-idea google-plus

我正在尝试将Google+登录添加到我的应用中,并且我知道我必须将Google Play Services添加到我的项目库中。所以我按照this StackOverflow问题中提供的步骤进行操作,但是当我完成时我收到了错误

Gradle: module 'google-play-services_lib' won't be compiled. Unfortunately you can't have non-Gradle Java module and Android-Gradle module in one project.

为了表明我已正确遵循说明,这就是我所做的。

  1. 我打开了Project Structure

  2. 点击左侧标签中的Modules,然后点击+按钮。

  3. 在下拉菜单中选择import modules

  4. 导航到google play services_lib文件夹的位置,在我的情况下是

    ..\sdk\extras\google\google_play_services\libproject\google-play-services_lib

  5. 点击我的项目(仍在项目结构中),然后打开右侧的dependencies标签。点击+按钮,然后从下拉菜单中选择Module Dependencies,并从库列表中选择google-play-services_lib。 然后我再次点击+按钮并从下拉菜单中选择jars or directories,然后导航到。

  6. ...\sdk\extras\google\google_play_services\libproject\google-play-services_lib\libs\google-play-services.jar

    我尝试重建项目甚至重启IntelliJ,但问题仍然存在。有什么帮助?

1 个答案:

答案 0 :(得分:0)

在评论中交谈后,我找出了你的情况:

  1. 首先删除您手动添加的Google Play服务模块。
  2. build.gradledependencies区块中添加下一行(例如来自https://plus.google.com/+AndroidDevelopers/posts/4Yhpn6p9icf):

    编译'com.google.android.gms:play-services:3.1.36'

  3. 不要忘记将项目与gradle文件同步!

相关问题