Gradle sync failed after switching to 3.0 canary 5
Asked Answered
G

1

8

After switching to Android Studio 3.0 canary 5 I can't build my gradle after some searching i found out that the error is caused due to outdated Guava library but i am not using Guava in my project.

Project Gradle

buildscript {
ext.kotlin_version = '1.1.3'
repositories {
    jcenter()
    maven { url 'https://maven.fabric.io/public' }
}
dependencies {
    classpath 'com.android.tools.build:gradle:3.0.0-alpha5'
    classpath 'com.google.gms:google-services:3.1.0'
    classpath 'io.fabric.tools:gradle:1.22.2'
    classpath 'com.google.firebase:firebase-plugins:1.1.0'
    classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
    // NOTE: Do not place your application dependencies here; they belong
    // in the individual module build.gradle files
}
}

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

task clean(type: Delete) {
delete rootProject.buildDir
}

App Gradle

apply plugin: 'com.android.application'
apply plugin: 'io.fabric'
apply plugin: 'kotlin-android'
apply plugin: 'com.google.firebase.firebase-perf'

android {
compileSdkVersion 26
buildToolsVersion '26.0.0'
defaultConfig {
    applicationId "com.nrs.nsnik.notes"
    minSdkVersion 19
    targetSdkVersion 26
    versionCode 15
    versionName "1.9.5"
    testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}
buildTypes {
    release {
        minifyEnabled false
        proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
    }
}
}

dependencies {
compile fileTree(include: ['*.jar'], dir: 'libs')
androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', {
    exclude group: 'com.android.support', module: 'support-annotations'
})
compile('com.crashlytics.sdk.android:crashlytics:2.6.8@aar') {
    transitive = true;
}
compile "org.jetbrains.kotlin:kotlin-stdlib-jre7:$kotlin_version"
compile 'com.android.support:appcompat-v7:26.0.0-beta2'
compile 'com.android.support.constraint:constraint-layout:1.0.2'
compile 'com.android.support:support-v4:26.0.0-beta2'
compile 'com.android.support:design:26.0.0-beta2'
compile 'com.android.support:cardview-v7:26.0.0-beta2'
compile 'com.android.support:palette-v7:26.0.0-beta2'
compile 'com.jakewharton:butterknife:8.6.0'
compile 'com.github.fafaldo:fab-toolbar:1.2.0'
compile 'com.google.firebase:firebase-perf:11.0.2'
compile 'com.google.firebase:firebase-ads:11.0.2'
compile 'com.google.android.gms:play-services-ads:11.0.2'
compile 'io.reactivex.rxjava2:rxandroid:2.0.1'
compile 'io.reactivex.rxjava2:rxjava:2.1.0'
compile 'com.github.bumptech.glide:glide:4.0.0-RC1'
compile 'com.android.support:customtabs:26.0.0-beta2'
compile 'com.google.guava:guava:22.0-android'
testCompile 'com.squareup.leakcanary:leakcanary-android-no-op:1.5.1'
annotationProcessor 'com.github.bumptech.glide:compiler:4.0.0-RC1'
annotationProcessor 'com.jakewharton:butterknife-compiler:8.5.1'
debugCompile 'com.squareup.leakcanary:leakcanary-android:1.5.1'
releaseCompile 'com.squareup.leakcanary:leakcanary-android-no-op:1.5.1'
testCompile 'junit:junit:4.12'
}
apply plugin: 'com.google.gms.google-services'

The Error :

Gradle sync failed: Cause: com.google.common.base.Preconditions.checkArgument(ZLjava/lang/String;Ljava/lang/Object;Ljava/lang/Object;Ljava/lang/Object;Ljava/lang/Object;)V
            Consult IDE log for more details (Help | Show Log) (18s 189ms)


Error:(1, 0) Unable to find method 'com.google.common.base.Preconditions.checkArgument(ZLjava/lang/String;Ljava/lang/Object;Ljava/lang/Object;Ljava/lang/Object;Ljava/lang/Object;)V'.

Possible causes for this unexpected error include:

  • Gradle's dependency cache may be corrupt (this sometimes occurs after a network connection timeout.) Re-download dependencies and sync project (requires network)
  • The state of a Gradle build process (daemon) may be corrupt. Stopping all Gradle daemons may solve this problem. Stop Gradle build processes (requires restart)
  • Your project may be using a third-party plugin which is not compatible with the other plugins in the project or the version of Gradle requested by the project.
In the case of corrupt Gradle processes, you can also try closing the IDE and then killing all Java processes.
Gorcock answered 4/7, 2017 at 7:16 Comment(4)
Which version of gradle are you using? Check you gradle-wrapper.propertiesTransmontane
Gradle 4.1-milestone-1 buildGorcock
solved, I had to remove classpath 'com.google.firebase:firebase-plugins:1.1.0' and compile 'com.google.firebase:firebase-perf:11.0.2'Gorcock
When I try this, I get a Error:Could not find com.google.firebase:firebase-perf:11.0.2. Any ideas?Angie
P
12

For me work

    classpath ('com.google.firebase:firebase-plugins:1.1.0') {
        exclude group: 'com.google.guava', module: 'guava-jdk5'
    }
Pistoia answered 4/7, 2017 at 22:41 Comment(1)
Thanks, at least the build has finished successfully. Hope removing guava won't have any consequences.Proclivity

© 2022 - 2025 — McMap. All rights reserved.