Closed JorgeCastilloPrz closed 6 years ago
The Limitations
of the README says the following:
The final classes you can mock are only those under the package of your app's BuildConfig. For example, if the FQCN of your BuildConfig is foo.bar.BuildConfig, you can mock only the final classes belonging to foo.bar.**. Therefore, you cannot mock final classes of both Android system classes and third-party libraries.
For example, if you have two modules like:
the classes you want to mock must be under the package indicated by the applicationId of app
even though they belong to lib
.
If the applicationId of app
isfoo.bar
, you will need to put the classes belonging to lib
into the package under foo.bar
(e.g. foo.bar.lib
).
I have just published a multiproject example. https://github.com/tmurakami/dexopener/tree/master/dexopener-example/multiproject
Alright, that makes a lot of sense now actually. My lib has a different package name. I'll try what you say and report back. Thanks for uploading that sample, will be very handy.
Your suggestion worked perfectly. I renamed application Id and package names for all the modules to be the same and then everything worked smoothly. Closing this issue now. Thanks for your help!
If you have a class defined on a pure Java or Kotlin library module (not Android) , let's say:
core
, then you write a UI test on yourapp
module (the android application module) which uses that dependency, dexopener fails.