Skip to content Skip to sidebar Skip to footer

Compile Errors After Updating To Workmanager 1.0.0-alpha09

I'm trying to use WorkManager from architecture components. I've upgraded the compileSdkVersion and targetSdkVersion from 27 to 28. gradle sync is successfully done. But build-time

Solution 1:

As per the WorkManager 1.0.0-alpha09 release notes:

Known Issue

If you run into the following issue: "More than one file was found with OS independent path 'META-INF/proguard/androidx-annotations.pro'", please put the following in your gradle file as a temporary workaround while we fix the issue in alpha10:

android {
    packagingOptions {
        exclude 'META-INF/proguard/androidx-annotations.pro'
    }
}

Edit: Your additional errors are caused by this issue:

It is done on purpose: https://groups.google.com/forum/#!topic/guava-announce/Km82fZG68Sw

New release of guava will be ready soon, that will resolve that issue automatically.

For now you can exclude "com.google.guava:listenablefuture" in your gradle file:

implementation("android.arch.work:work-runtime:1.0.0-alpha09") {
    exclude group: 'com.google.guava', module: 'listenablefuture' 
}

Solution 2:

Everything works fine if you have a project with Guava v27 and the newest version of WorkManager. I just tried it out and it fixes my project.

This builds just fine:

dependencies {
   implementation 'android.arch.work:work-runtime:1.0.0-beta01'
   implementation 'com.google.guava:guava:27.0.1-android'
}

Solution 3:

The release notes say this bug was fixed in 1.0.0-alpha10:

Bug Fixes

Fixed the known issue from alpha09 regarding duplicate androidx-annotations.pro files. You may remove the workaround from the previous release notes by deleting exclude 'META-INF/proguard/androidx-annotations.pro' from your gradle file.

source


But... for some reason i still seeing this error in 1.0.0-alpha11 version.

a workaround for this, is to exclude listenablefuture module from work-runtime component as @ianhanniballake pointed in his answer.

And also exclude the same module in work-firebase component as @Zack pointed in the comments section.


build.gradle

/*
    |--------------------------------------------------------------------------
    | WorkManager
    |--------------------------------------------------------------------------
    */

    def work_version = "1.0.0-alpha11"implementation("android.arch.work:work-runtime:$work_version") {
        exclude group: 'com.google.guava', module: 'listenablefuture'
    }

    // optional - Firebase JobDispatcher supportimplementation("android.arch.work:work-firebase:$work_version") {
        exclude group: 'com.google.guava', module: 'listenablefuture'
    }

    // optional - Test helpers
    androidTestImplementation "android.arch.work:work-testing:$work_version"

Post a Comment for "Compile Errors After Updating To Workmanager 1.0.0-alpha09"