Android – Warning:Conflict with dependency ‘com.google.code.findbugs:jsr305’ solution

When I tried to add these library dependencies:

    compile 'com.trello:rxlifecycle:0.7.0'
    compile 'com.trello:rxlifecycle-android:0.7.0'

I received following error:

Warning:Conflict with dependency ‘com.google.code.findbugs:jsr305’. Resolved versions for app (3.0.1) and test app (2.0.1) differ. See http://g.co/androidstudio/app-test-app-conflict for details.
Error:Execution failed for task ‘:app:prepareDebugAndroidTestDependencies’.
> Dependency Error. See console for details.
Information:BUILD FAILED

Then I googled and found this solution:
In your apps build.gradle add the following within android { }:

configurations.all {
    resolutionStrategy.force 'com.google.code.findbugs:jsr305:1.3.9'
}

How to use lambda in Android Studio?

First of all, add following to build.gradle(app) file:

android {
    defaultConfig {
       ...
        jackOptions {
            enabled true
        }
    }
    compileOptions {
        sourceCompatibility JavaVersion.VERSION_1_8
        targetCompatibility JavaVersion.VERSION_1_8
    }
}

After that you can use lambda in your application:

        Button button = (Button) findViewById(R.id.button);
        button.setOnClickListener(v-> Toast.makeText(getApplicationContext(), "Hello Lambda", Toast.LENGTH_LONG).show());

instead of this:

        button.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                Toast.makeText(getApplicationContext(), "Hello Lambda", Toast.LENGTH_LONG).show();
            }
        });