Mockito on Android emulator

时间秒杀一切 提交于 2019-12-04 10:44:26

You have to make sure th Mockito's JAR is part of you APK dependencies.

If you are using Intellij, open project settings, and Module->Dependencies, and add Mockito as part of dependency.

If you are using obfuscation, you also have to make sure its not obfuscating mockito's class from your built apk.

I had the same issues while I'm calling a native API without the mocking them -- make sure you have a mock of the native calls. Check also the linkage error and not only the Mockito exception.

This issue may be caused by not having the libraries on your actual android device, even though you may have added them to Eclipse or Android Studio.

In my android test project I was able to fix this problem by creating a libs folder and putting the three required libraries in it. Be sure the name of your created folder is actually "libs" and NOT "lib"

Here's a link from the android developer site with more detailed directions for adding support libraries. http://developer.android.com/tools/support-library/setup.html

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!