Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Project cannot be compiled after upgrading to gradle:2.1.0-alpha5

I have an Android project that worked perfectly with pre-gradle:2.1.0-alpha3 versions. Now it's throwing these kinds of errors with no clue of how to resolve them:

Error:Execution failed for task ':app:compileDebugJavaWithJavac'.
> java.lang.NoSuchMethodError: com.google.common.collect.FluentIterable.append(Ljava/lang/Iterable;)Lcom/google/common/collect/FluentIterable;

It's quite strange, there's a particular branch that for the last four or five days also used to throw duplicate objects in the apk, details here

My app's module build.gradle:

buildscript {
    repositories {
        jcenter()
    }
    dependencies {
        classpath 'com.android.tools.build:gradle:2.1.0-alpha5'
        classpath 'com.neenbedankt.gradle.plugins:android-apt:1.8'
    }
}

allprojects {
    repositories {
        jcenter()
    }

    gradle.projectsEvaluated {
        tasks.withType(JavaCompile) {
            options.compilerArgs << "-Xlint:unchecked"
        }
    }
}

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

and my module's build.gradle:

apply plugin: 'com.android.application'
apply plugin: 'com.neenbedankt.android-apt'

android {
    compileSdkVersion 23
    buildToolsVersion '23.0.3'

    defaultConfig {
        applicationId "..."
        minSdkVersion 14
        targetSdkVersion 23
        versionCode 1
        versionName "1.0"
        multiDexEnabled true
    }
    dataBinding {
        enabled = true
    }

    lintOptions {
        disable 'InvalidPackage'
    }

    dexOptions {
        javaMaxHeapSize "4g"
        preDexLibraries = false
    }

    buildTypes {
        release {
            minifyEnabled true
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
        debug {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
    }
    compileOptions {
        sourceCompatibility JavaVersion.VERSION_1_7
        targetCompatibility JavaVersion.VERSION_1_7
    }
}

//PixlUI
repositories {
    maven {
        url "https://jitpack.io"
    }
    mavenCentral()
}

dependencies {
    compile fileTree(include: ['*.jar'], dir: 'libs')
    // Dagger 2
    apt 'com.google.dagger:dagger-compiler:2.0.2'
    provided 'org.glassfish:javax.annotation:10.0-b28'
    //Autodagger
    apt 'com.github.lukaspili.autodagger2:autodagger2-compiler:1.1'
    provided 'javax.annotation:jsr250-api:1.0'

    compile 'com.android.support:design:23.2.1'
    compile 'com.android.support:appcompat-v7:23.2.1'
    compile 'com.android.support:cardview-v7:23.2.1'
    compile 'com.android.support:recyclerview-v7:23.2.1'
    compile 'com.google.android.gms:play-services-location:8.4.0'
    compile 'com.google.android.gms:play-services-wallet:8.4.0'
    compile 'com.google.android.gms:play-services-auth:8.4.0'
    compile 'com.android.support:support-v4:23.2.1'
    compile 'com.android.support:multidex:1.0.1'
    compile 'com.google.dagger:dagger:2.0.2'
    compile 'com.github.lukaspili.autodagger2:autodagger2:1.1'
    compile 'de.hdodenhof:circleimageview:1.3.0'
    compile 'net.steamcrafted:materialiconlib:1.0.3@aar'
    compile 'com.lorentzos.swipecards:library:1.0.9@aar'
    compile 'com.squareup.picasso:picasso:2.5.2'
    compile 'de.greenrobot:eventbus:2.4.0'
    compile 'com.jakewharton:butterknife:7.0.1'
    compile 'com.github.neopixl:PixlUI:v1.0.6'
    compile 'com.scottyab:secure-preferences-lib:0.1.4'
    compile 'com.squareup.retrofit:retrofit:1.9.0'
    compile 'io.card:android-sdk:5.3.0'
    compile 'com.paypal.sdk:paypal-android-sdk:2.13.1'
}

Any kind of help or pointer is greatly appreciated

like image 202
Chisko Avatar asked Apr 02 '16 20:04

Chisko


1 Answers

Issue is with dagger's dependency. you need to use new version of dagger, namely v2.1 or above.

(REF: the official issue)

like image 64
Avinash R Avatar answered Dec 02 '22 14:12

Avinash R