When I run my app on emulator or regular android phone through debug mode everything works. But installing it via signed app causes it to crash when (I believe) accessing or rather trying to access non saved files in internal private storage.
I have
<uses-permission android:name="android.permission.WRITE_INTERNAL_STORAGE" />
<uses-permission android:name="android.permission.READ_INTERNAL_STORAGE" />
in my manifest file just in case.
My app has some raw test data in res folder that is copied to internal storage where it would normally be created by user through regular use. Everything works in debug mode but not normally. (saving through usage of app works so I guess the problem is either accessing raw resources or copying them to internal storage)
What could be the cause?
here is the code for raw -> internal transfer
File file = getApplicationContext ().getFileStreamPath(userTemp);
try {
InputStream inputStream = getResources().openRawResource(
getResources().getIdentifier(user, "raw", getPackageName())
);
FileOutputStream fileOutputStream = new FileOutputStream (file);
byte buf[]=new byte[1024];
int len;
while((len=inputStream.read(buf))>0) {
fileOutputStream.write(buf,0,len);
}
fileOutputStream.close();
inputStream.close();
} catch (IOException e1) {}
user and userTemp are just simple string file names
EDIT: just to confirm, res files exists in apk file
EDIT2: the files are copied from raw resources to internal app storage but for some reason they can't be read, however as I said before, debug runs great