【问题标题】:Error:Cannot change configuration ':android:compile' after it has been resolved错误:解决后无法更改配置“:android:compile”
【发布时间】:2015-12-07 20:29:57
【问题描述】:

我尝试将 google-play-services.jar 添加到我的项目中,但遇到了这个错误。为什么? (Error:Cannot change configuration ':android:compile' after it has been resolved.) 有人知道解决这个问题的方法吗?

【问题讨论】:

  • 视情况而定。你把罐子放在哪里了?你的 build.gradle 怎么样了?

标签: android android-studio import build.gradle


【解决方案1】:

在android studio中你不需要添加jar文件,删除jar文件和

  1. 打开应用程序模块目录中的 build.gradle 文件。

    注意:Android Studio 项目包含一个顶级 build.gradle 文件和每个模块的 build.gradle 文件。请务必为您的应用程序模块编辑文件

  2. 在最新版本的播放服务的依赖项下添加新的构建规则。例如:

    dependencies {
    compile 'com.google.android.gms:play-services:7.8.0'
    }
    
  3. 保存更改并单击工具栏中的 Sync Project with Gradle Files。

这里是官方link

【讨论】:

    猜你喜欢
    • 2017-04-10
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2022-07-04
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多