in Education by
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)

1 Answer

0 votes
by
logger.getFileName() - returns real file name for example: "logs_22032019.txt" That is not a valid filesystem path. It is a valid filename, but it does not say where that file is supposed to be on the device. This is your FileProvider configuration: For that, a File that would work is: File file = new File(getFilesDir(), "logs/"+logger.getFileName()); there is really the path of files... But FileProvider in it goes to Those are the same filesystem location, for the primary device user.

Related questions

0 votes
    I looked at all the answers on StackOverflow and there no answer for me. Same error for ... and emulators. Fileprovider always throws IllegalArgumentException There is Manifest...
asked Apr 26, 2022 in Education by JackTerrance
0 votes
    I updated support lib version to 24.2.0 and my registration screen is dead now. The problem is in ... JavaScript Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked Jul 8, 2022 in Education by JackTerrance
0 votes
    I believe that i messed up with configuration but I cannot get where and how to fix it. Here you ... JavaScript Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked May 13, 2022 in Education by JackTerrance
0 votes
    I believe that i messed up with configuration but I cannot get where and how to fix it. Here you ... JavaScript Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked May 4, 2022 in Education by JackTerrance
0 votes
    I am using Smack in an Android app for XMPP based communication. I am trying to create a privacy ... JavaScript Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked Feb 18, 2022 in Education by JackTerrance
0 votes
    ________ function is usually used inside another function and throws a warning whenever a particular package is not ... R Programming Select the correct answer from above options...
asked Feb 12, 2022 in Education by JackTerrance
0 votes
    How does one write a unittest that fails only if a function doesn't throw an expected exception? Select the correct answer from above options...
asked Jan 30, 2022 in Education by JackTerrance
0 votes
    Suppose a girl throws a die. If she gets a 5 or 6, she tosses a coin three times and notes the number of heads ... 3 or 4 with the die? Select the correct answer from above options...
asked Nov 25, 2021 in Education by JackTerrance
0 votes
    Find the probability of getting 5 exactly twice in 7 throws of a die. Select the correct answer from above options...
asked Nov 25, 2021 in Education by JackTerrance
0 votes
    Find the probability of throwing at most 2 sixes in 6 throws of a single die. Select the correct answer from above options...
asked Nov 25, 2021 in Education by JackTerrance
0 votes
    A and B throw a pair of dice. If A throws 9, find B’s chance of throwing a higher number. Select the correct answer from above options...
asked Nov 25, 2021 in Education by JackTerrance
0 votes
    A die is thrown twice. What is the probability that at least one of the two throws come up with the number 3? Select the correct answer from above options...
asked Nov 22, 2021 in Education by JackTerrance
0 votes
    Apoorv throws two dice once and computes the product of the numbers appearing on the dice. Peehu throws one die and ... number 36? Why? Select the correct answer from above options...
asked Nov 21, 2021 in Education by JackTerrance
0 votes
0 votes
    In a game the entry fee is ₹5. The game consists of tossing coins 3 times. If one or two heads show, Sweta ... just gets her entry fee. Select the correct answer from above options...
asked Nov 17, 2021 in Education by JackTerrance
...