Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
390 views
in Technique[技术] by (71.8m points)

android - Gradle project sync failing after Google announced the new sdk versioning system

I am getting the following error:

Cannot change dependencies of configuration ':app:api' after it has been included in dependency resolution.

Updated: I am able to build using com.google.gms:google-services:3.3.0 when data binding is disabled, but this is not a solution for someone that requires data binding to be enabled.

After Google announced the new sdk versioning system (link), I did the following steps:

  1. I updated the gradle files as directed to include the gms and firebase version numbers separately. Updated the apply plugin line, updated the classpath. I am still getting the error and dont know the reason.

  2. Below are relevant gradle files:

build.gradle (main):

buildscript {
    repositories {
        google()
        jcenter()
        maven { url 'https://dl.bintray.com/rvalerio/maven' }
        maven { url 'https://maven.fabric.io/public' }
    }
    dependencies {
        classpath 'com.android.tools.build:gradle:3.1.2'
        classpath 'com.google.gms:google-services:3.3.0'
        classpath 'com.neenbedankt.gradle.plugins:android-apt:1.8'
        classpath 'io.realm:realm-gradle-plugin:4.3.3'
        classpath 'io.fabric.tools:gradle:1.25.1'
        // NOTE: Do not place your application dependencies here; they belong
        // in the individual module build.gradle files
    }
}

allprojects {
    repositories {
        google()
        jcenter()
        maven { url 'https://jitpack.io' }
        maven { url 'https://maven.google.com' }
    }
}

build.gradle (Module:app)

apply plugin: 'com.google.gms.google-services'

Firebase dependencies:

//Firebase Dependencies
implementation "com.google.firebase:firebase-messaging:15.0.2"
implementation "com.google.firebase:firebase-core:15.0.2"
implementation "com.google.firebase:firebase-config:15.0.2"
implementation('com.crashlytics.sdk.android:crashlytics:2.9.1@aar') {
    transitive = true
}

GMS and other dependencies

implementation "com.android.support:recyclerview-v7:27.1.1"
implementation "com.android.support:support-v4:27.1.1"
implementation "com.android.support:cardview-v7:27.1.1"
implementation "com.android.support:design:27.1.1"
implementation "com.android.support:support-v13:27.1.1"
implementation "com.android.support.constraint:constraint-layout:1.1.0"
implementation "com.google.android.gms:play-services-location:15.0.1"
implementation "com.google.android.gms:play-services-vision:15.0.1"
implementation "com.google.android.gms:play-services-auth:15.0.1"
implementation "com.google.android.gms:play-services-maps:15.0.1"
  1. I have pasted the error log on pastebin from android studio 3.1.2 here.

Any help is appreciated!

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)
Waitting for answers

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...