title: Android: after Gradle update to 6.7.1 ClassLoader in JUnit test no longer lists all resources
body: <p>I need to iterate over specific classes from main package in my android unit test, to check some of their properties.
  For this I use standard approach, using ClassLoader:</p>
  <pre><code> val classLoader = Thread.currentThread().contextClassLoader 
   val resources: Enumeration&lt;URL&gt; = classLoader.getResources(&quot;com/models/package&quot;)
   assert(resources.hasMoreElements()) // Fails from CL, works in AS
   
  </code></pre>
  <p>Before the Gradle update (had Gradle 5.6.4) that worked. Now the behaviour is as follows: it works when test is run from Android Studio, but fails (returns empty enumeration) when run from command line with gradlew.</p>
  <p>I wonder what might be the difference in this respect between the two Gradle versions? And why it still works when run from Studio?</p>
  <p>Some considerations and things I have tried:</p>
  <ul>
  <li>Referencing these classes in unit test works ok, and also classLoader.findClass(&quot;com.models.package.MyModel&quot;) and
  classLoader.loadClass(&quot;com.models.package.MyModel&quot;) from unit test is working. But even after that classLoader.getResources(&quot;com/models/package&quot;) returns empty enumeration.</li>
  <li>Using other references to ClassLoader, like MyModel::class.java.classLoader and ClassLoader.getSystemClassLoader() didn't make any difference.</li>
  <li>Gradle build from command line contains the warning &quot;OpenJDK 64-Bit Server VM warning: Sharing is only supported for boot loader classes because bootstrap classpath has been appended&quot;, but as far as I can tell it's not connected to my issue.</li>
  <li>If I put some of the classes from 'com/models/package' to the unit test /test folder, they are getting returned in enumeration.</li>
  </ul>
  <p>This might be connected with some new optimisation setting that makes ClassLoaders omit registering some of the classes, in different root directories, but as it still works in AS there might be some setting to turn this optimisation off in a command line build also?</p>
  <p>Thank you for any suggestions on this.</p>