LoginSignup
5
5

More than 5 years have passed since last update.

AndroidのJUnitを利用したユニットテストでjava.lang.IllegalAccessError

Last updated at Posted at 2014-04-17

ユニットテストを実行しようとと思ったら

コンソール画面に


Test run failed: Instrumentation run failed due to 'java.lang.IllegalAccessError'


と表示されてテストが実行されなかった.

ライブラリプロジェクトの指定がダメっぽい

はじめはこれで指定した

test1.png

これだと実行時にタイトルのエラーが発生する.

ビルドパス画面のプロジェクト追加でいけた

test2.png

なんでコレじゃ無いとダメなんだろ…?
Espresso利用のため,Instrumentation runnerを GoogleInstrumentationTestRunner にしてるから?

追記

android.test.InstrumentationTestRunner でも発生しました

その他

ビルドパスの追加でテストを実行すると,Could not find **Lib.apk! っていうエラーがコンソールに表示される.
けど,まぁ単なるライブラリなのでapkが有るわけ無く,問題ない.

5
5
2

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
5
5