I am trying to load in a file and I am getting a FileNotFoundException even though the file is present. I have tried doing the absolute path (C:/Users/cdeck_000/AndroidStudioProjects/ProjectCaligula_Final/cert/cert.crt) and the relative path (cert/cert.crt) assuming Android starts at the project level. When I run it using the relative path and ask for the file absolute path I get this:
Path: /cert/cert.crt
The code is below along with the project structure.
File file = new File("cert/cert.crt");
boolean i = file.exists(); //false
boolean r = file.canRead(); //false
String path = file.getAbsolutePath(); //cert/cert.crt
String pathForApp = new File(".").getAbsolutePath(); //returns "/."
InputStream caInput = new BufferedInputStream(new FileInputStream(file)); //error
Can anyone chime in and let me know if my knowledge of absolute/relative paths with Android is wrong or give me advice on how to solve this? I have already thought that permissions was the issue but I raised the files permissions (equivalent to chmod 777) and it didn't change anything.