getClassLoader().getResourceAsStream(file_path) returns null after Android Studio updated to 4.2

282 Views Asked by At

The following code worked for many years:

InputStream is = myclass.class.getClassLoader().getResourceAsStream("res/raw/my_file.xml");

I updated Android Studio to 4.2 and that led to a serious other updates (e.g., gradle plug-in). getResourceAsStream() still returns correct InputStream that works perfectly for the debug version, however, it returns null for the release version that uses Proguard for compression and obfuscation. Again, it worked flawlessly for many years.

Could anyone shed some light on the possible causes for this breaking by Android Studio update?

0

There are 0 best solutions below