I have an android application that has a dependent library I created, referenced in build.gradle via compile {artifact_name}. The library needs to access a resource file in its resources dir(src/main/resources). Here is what I want to accomplish, but can't:
URL url = helper.class.getClassLoader().getResource("myfile.json"); FileReader fr = new FileReader(url.getPath()); myfile.json is in src/main/java/resources of my library. this led to an app crash saying "jar:file:/data/app/com.my.app/base.apk!/myfile.json" not found when trying to create the FileReader.
However, it can be found if I run it in a client class in the library itself.