无法删除旧的 javaCompile 操作,可能是类名已更改

2022-09-03 15:47:12

我正在学习RxJava。为此,我关注了RxJava上的droidcon谈话视频。教师已为他正在使用的项目提供了存储库链接。当我尝试在计算机中构建项目时,我克隆了存储库。我收到此错误

错误:无法删除旧的javaCompile操作,可能是类名已更改?请提交一份错误报告,其中包含您正在使用的 gradle 版本。

这是 gradle.build 文件

    buildscript {
    repositories {
        mavenCentral()
    }

    dependencies {
        classpath 'me.tatarka:gradle-retrolambda:2.5.0'
    }
}

repositories {
    mavenCentral()
    maven { url "https://github.com/alter-ego/advanced-android-logger/raw/develop/releases/" }
}

apply plugin: 'retrolambda'
apply plugin: 'com.android.application'

android {
    compileSdkVersion 23
    buildToolsVersion "25.0.0"

    defaultConfig {
        applicationId "com.packtpub.apps.rxjava_essentials"
        minSdkVersion 16
        targetSdkVersion 22
        versionCode 1
        versionName "1.0"
        jackOptions {
            enabled true
        }
    }

    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
    }

    compileOptions {
        sourceCompatibility JavaVersion.VERSION_1_8
        targetCompatibility JavaVersion.VERSION_1_8
    }

    lintOptions {
        disable 'InvalidPackage'
        abortOnError false
    }

    packagingOptions {
        exclude 'META-INF/services/javax.annotation.processing.Processor'
    }
}

dependencies {
    compile fileTree(dir: 'libs', include: ['*.jar'])
    compile 'com.android.support:support-v4:23.1.1'
    compile "com.android.support:appcompat-v7:23.1.1"
    compile 'com.android.support:recyclerview-v7:23.1.1'
    compile 'com.android.support:cardview-v7:23.1.1'

    compile 'com.jakewharton.timber:timber:4.1.0'

    compile 'org.projectlombok:lombok:1.14.8'
    compile 'com.jakewharton:butterknife:6.0.0'

    compile 'io.reactivex:rxandroid:1.1.0'
    compile 'io.reactivex:rxjava:1.1.0'
    compile 'io.reactivex:rxjava-joins:0.22.0'

    compile 'com.google.guava:guava:18.0'
    compile 'com.google.code.gson:gson:2.4'

    compile 'com.github.lzyzsd:circleprogress:1.1.0@aar'
    compile 'com.github.rey5137:material:1.0.0'

    compile 'com.squareup.retrofit:retrofit:1.9.0'
    compile 'com.squareup.okhttp:okhttp-urlconnection:2.0.0'
    compile 'com.squareup.okhttp:okhttp:2.0.0'

    compile 'com.nostra13.universalimageloader:universal-image-loader:1.9.3'

}

任何想法如何解决这个问题?


答案 1

问题来自 RetroLambda 插件(请参阅此链接中的第 108 行)。

我假设升级插件版本可以解决您的问题:

classpath 'me.tatarka:gradle-retrolambda:3.6.1'

答案 2

github上的app/build.gradle
Reference上尝试这个

 buildscript {
        repositories {
            mavenCentral()
        }

        dependencies {
            classpath 'me.tatarka:gradle-retrolambda:3.4.0'
        }
    }

    repositories {
        mavenCentral()
        maven { url "https://github.com/alter-ego/advanced-android-logger/raw/develop/releases/" }
    }

    apply plugin: 'com.android.application'
    apply plugin 'me.tatarka:gradle-retrolambda:3.4.0'

    android {
        compileSdkVersion 23
        buildToolsVersion "23.0.2"

        defaultConfig {
            applicationId "com.packtpub.apps.rxjava_essentials"
            minSdkVersion 16
            targetSdkVersion 22
            versionCode 1
            versionName "1.0"
        }

        buildTypes {
            release {
                minifyEnabled false
                proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
            }
        }

        compileOptions {
            sourceCompatibility JavaVersion.VERSION_1_8
            targetCompatibility JavaVersion.VERSION_1_8
        }

        lintOptions {
            disable 'InvalidPackage'
            abortOnError false
        }

        packagingOptions {
            exclude 'META-INF/services/javax.annotation.processing.Processor'
        }
    }

    dependencies {
        compile fileTree(dir: 'libs', include: ['*.jar'])
        compile 'com.android.support:support-v4:23.1.1'
        compile "com.android.support:appcompat-v7:23.1.1"
        compile 'com.android.support:recyclerview-v7:23.1.1'
        compile 'com.android.support:cardview-v7:23.1.1'

        compile 'com.jakewharton.timber:timber:4.1.0'

        compile 'org.projectlombok:lombok:1.14.8'
        compile 'com.jakewharton:butterknife:6.0.0'

        compile 'io.reactivex:rxandroid:1.1.0'
        compile 'io.reactivex:rxjava:1.1.0'
        compile 'io.reactivex:rxjava-joins:0.22.0'

        compile 'com.google.guava:guava:18.0'
        compile 'com.google.code.gson:gson:2.4'

        compile 'com.github.lzyzsd:circleprogress:1.1.0@aar'
        compile 'com.github.rey5137:material:1.0.0'

        compile 'com.squareup.retrofit:retrofit:1.9.0'
        compile 'com.squareup.okhttp:okhttp-urlconnection:2.0.0'
        compile 'com.squareup.okhttp:okhttp:2.0.0'

        compile 'com.nostra13.universalimageloader:universal-image-loader:1.9.3'

    }

推荐