I looked at all the answers on StackOverflow and there no answer for me.
Same error for real device and emulators.
Fileprovider always throws IllegalArgumentException
There is Manifest
There is filepath.xml
And there is code which always throw exception
final Intent emailIntent = new Intent(Intent.ACTION_SEND);
emailIntent.setFlags(Intent.FLAG_GRANT_READ_URI_PERMISSION);
File file = new File(logger.getFileName());
Uri uri = null;
try {
uri = FileProvider.getUriForFile(getContext(), BuildConfig.APPLICATION_ID, file);
} catch (IllegalArgumentException e) {
e.printStackTrace();
}
logger.getFileName() - returns real file name for example: "logs_22032019.txt"
What I already tried: Changes in Manifest such as: android:authorities="com.realname.of.package" Changes in filepath.xml
name="logs"
1) same name of file 2) just /
path="logs/"
1) . 2) / 3) full path 4) files 5) /files 6) files/ e.t.g
What I'm noted - there is really the path of files:
/data/user/0/com.app.realname/files/log.txt
But FileProvider in it goes to:
"log.txt" -> "/data/data/com.app.realname/files/log.txt"-->
NOTE: I need only INTERNAL storage.
JavaScript questions and answers, JavaScript questions pdf, JavaScript question bank, JavaScript questions and answers pdf, mcq on JavaScript pdf, JavaScript questions and solutions, JavaScript mcq Test , Interview JavaScript questions, JavaScript Questions for Interview, JavaScript MCQ (Multiple Choice Questions)