lundi 1 octobre 2018

Android gradle androidTestApi & testApi configuration obsoleted

I got 2 modules, module A and module B. Module B depends on module A when module A shares dependency libraries to module B by using api configuration.

When setting up test environment, inside module A, I also use testApi & androidTestApi to make module B uses shared testing libraries. However, after running gradle sync, I got warning message: WARNING: Configuration 'testApi' is obsolete and has been replaced with 'testImplementation'.

Read the provided link and it said that other modules can't depend on androidTest, you get the following warning if you use the androidTestApi configuration. Therefore, I must define test libraries in module B in my example for skipping this warning.

I have some questions on this situation:

  1. Why one module should not depends on testing dependencies of other module, although it can depend on normal dependencies defined as api?
  2. Do we have anyway to force module B depends on test libraries of module A without defined these libraries again in module B?

Many thanks

Aucun commentaire:

Enregistrer un commentaire