Search code examples
androidgradlemoduledependenciescannot-find-symbol

annotation dependency from module not working


build.gradle

configurations.all {
resolutionStrategy {
    force 'com.android.support:support-annotations:23.1.1'
}}

Async Task

import android.annotation.MainThread; import android.annotation.Nullable; import android.annotation.WorkerThread;

Any idea why the above imports cannot be resolved?


Solution

  • Disclaimer: I know nothing about Android development.

    In Gradle, dependencies are defined in the dependencies configuration block like this:

    dependencies {
        implementation 'com.android.support:support-annotations:23.1.1'
    } 
    

    Read mir about this in the dependencies userguide.

    resolutionStrategy in contrast, is used to control which version of a particular dependency to use in case a version conflict occurs (transitive dependencies) beside other use cases.