如何创建测试模块以在IntelliJ IDEA中测试Android库

我创建了一个
Android库,但是当我尝试创建一个Android测试模块时,测试模块组合框只有一个红色[无],我无法选择库本身.

我是否需要故意创建一个Android应用程序来测试库?

最佳答案 我在JetBrains论坛上问了这个
reply

Currently there is no way to create test module
for library module automatically. You can, for example, create
application module that depends on the library module, and then create
test module for it. Another way is to put the instrumentation into the
application module itself, so additional “test” module is not needed.

点赞