日々精進

新しく学んだことを書き留めていきます

./gradlew connectedCheckを実行すると「com.android.dex.DexException: Multiple dex files define Lorg/hamcrest/Description」エラー

原因は以下のandroidTestCompileにあった。

androidTestCompile 'junit:junit:4.11'
androidTestCompile 'org.robolectric:robolectric:2.4+'

Robolectric2.4がJUnit 4.8.1に依存しているがそれとは別に4.11もインストールしているためhamcrestが重複してしまっていた。 junitのバージョンを4.8+に変更すると直った。

参考: