I'm trying to make a hex dumping application and for that, I need to read the file bytes. I'm using apache io version 2.8.0 to do the hex dumping. This is the code I'm using:
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
try {
byte[] bytes = Files.readAllBytes(Paths.get(getPackageManager().getApplicationInfo("com.pixel.gun3d", 0).nativeLibraryDir.concat("/libil2cpp.so")));
Log.e("MainActivity", dumpHex(bytes));
} catch (PackageManager.NameNotFoundException | IOException e) {
e.printStackTrace();
}
}
private String dumpHex(byte[] bytes) {
ByteArrayOutputStream out = new ByteArrayOutputStream();
try {
HexDump.dump(bytes, 0, out, 0);
} catch (IOException e) {
e.printStackTrace();
}
return new String(out.toByteArray());
}
And the error I get is this: java.lang.OutOfMemoryError: Failed to allocate a 155189264 byte allocation with 25165824 free bytes and 94MB until OOM, max allowed footprint 328602112, growth limit 402653184
I looked it up and none of the suggestions I tried such as adding android:largeHeap="true" and android:hardwareAccelerated="false" to the manifest worked. Any help is appreciated <3