I'm about to release my first Android library. As part of that library I supply "smart" test double classes for easier unit testing.
Currently I just package the test doubles together with the production classes. However, it's ugly and feels unfriendly to the users.
How can I add classes to Android library that the clients will be able to use only in test code?
You can't really enforce that. I would put the doubles in a separate namespace ("test" or "test helpers" or something along these lines). If you do that and name the classes accordingly ("ThingMock" or "ThingTestDouble") then it is really the developers fault if they use them for production code.