i++

プログラム系のメモ書きなど

Android : Warning:Conflict with dependency 'com.android.support:support-annotations'. Resolved versions for app (23.1.0) and test app (22.2.0) differ.

エラーメッセージ全文は以下のとおりです。
解決のために参考となる URL が記載されているなんて素晴らしい!

Warning:Conflict with dependency 'com.android.support:support-annotations'. Resolved versions for app (23.1.0) and test app (22.2.0) differ. See http://g.co/androidstudio/app-test-app-conflict for details.

具体的には、実際のアプリ用のコードとテスト用のコードで、同じライブラリのバージョン違いを使ってしまっていることが問題になっているので、同じバージョンを使うように設定をすれば良いということでした。

gradle (app) の dependencies 内に

androidTestCompile 'com.android.support:support-annotations:23.1.0'

という一行を追加して、テストの方で使う support-annotations のバージョンを明示的に指定することでエラー解消です。

最終的な dependencies の全体は以下の様な具合に。

dependencies {
    compile fileTree(dir: 'libs', include: ['*.jar'])

    testCompile 'junit:junit:4.12'

    androidTestCompile 'com.android.support.test:runner:0.3'
    androidTestCompile 'com.android.support.test:rules:0.3'
    androidTestCompile 'com.android.support:support-annotations:23.1.0'

    compile 'com.android.support:appcompat-v7:23.1.0'
    compile 'com.android.support:support-v4:23.1.0'
    compile 'com.android.support:design:23.1.0'
}