kiruwka kiruwka - 1 year ago 111
Android Question

sources of Testing Support Library in Android Studio

How to attach sources from*
for debugging in AS?

Tried downloading sources from but the version doesn't seem to match my testing library version.

Testing sources (for instance
) don't seem to be available via sdk manager, am I missing something ?

Answer Source

I encountered a similar problem and it took a quite amount of time to figure it out. It seems like a bug due to a missing Gradle task not executed because the SAME configuration used to work but not any more after upgrading to AS v1.2+.

First, the following dependency is obsolete.

androidTestCompile ''

And it is updated as follows in the documentation.

androidTestCompile ''
androidTestCompile ''

The defaultConfig should include the following line as usual.

testInstrumentationRunner ""

Also, make sure the Android Support Repository is installed through the SDK Manager.

If* cannot be resolved, then manually execute the Gradle task as follows.

  1. Click the Gradle tab on the right.
  2. Collapse your Android module and brow the Tasks node.
  3. Double click to execute other->generateDebugAndroidTestSources

If succeeded, the issue may be solved. At least, it works for me.


It seems like there are still chances this could happen on AS 2.1.2. To be noted, if you have more than one Android modules, running the gradle task generateDebugAndroidTestSources from one particular should be enough for all, especially the Android library module one.

enter image description here

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download