In my case the problem was that TestFragmentActivity, meaning the Activity used in our test
extends ActivityInstrumentationTestCase2
must be available in the package defined in Manifest.xml as targetPackage:
My solution was to move TestFragmentActivity into tested application package.