Fileprovider always throws IAE Announcing the arrival of Valued Associate #679: Cesar Manara Planned maintenance scheduled April 23, 2019 at 23:30 UTC (7:30 pm US/Eastern) Data science time! April 2019 and salary with experience The Ask Question Wizard is Live!Possible to use share internal files (e.g. using FileProvider) within a flex native extension to other appsSecurityException with grantUriPermission when sharing a file with FileProviderFileProvider is queried by a client app with “_data” in projectionFileProvider path creation and BitmapFactory.decodefile problems in AndroidUsing FileProvider cache-path for gmail attachment shows “invalid” errorProblems with FileProviderFileProvider: No data when sending fileFile Provider: Failed to find configured root that contains_data column not available at FileProvider uriandroid getUriForFile fails for external_files_path
"Working on a knee"
Will I be more secure with my own router behind my ISP's router?
What's parked in Mil Moscow helicopter plant?
What happened to Viserion in Season 7?
How do I deal with an erroneously large refund?
Can gravitational waves pass through a black hole?
What's the difference between using dependency injection with a container and using a service locator?
Why aren't road bicycle wheels tiny?
Will temporary Dex penalties prevent you from getting the benefits of the "Two Weapon Fighting" feat if your Dex score falls below the prerequisite?
SQL Server placement of master database files vs resource database files
Why did Israel vote against lifting the American embargo on Cuba?
Retract an already submitted Recommendation Letter (written for an undergrad student)
Married in secret, can marital status in passport be changed at a later date?
How would it unbalance gameplay to rule that Weapon Master allows for picking a fighting style?
Does Prince Arnaud cause someone holding the Princess to lose?
Coin Game with infinite paradox
Does a Draconic Bloodline sorcerer's doubled proficiency bonus for Charisma checks against dragons apply to all dragon types or only the chosen one?
Is there a way to fake a method response using Mock or Stubs?
Arriving in Atlanta (after US Preclearance in Dublin). Will I go through TSA security in Atlanta to transfer to a connecting flight?
TV series episode where humans nuke aliens before decrypting their message that states they come in peace
What is the numbering system used for the DSN dishes?
What do you call an IPA symbol that lacks a name (e.g. ɲ)?
What is ls Largest Number Formed by only moving two sticks in 508?
Simulate round-robin tournament draw
Fileprovider always throws IAE
Announcing the arrival of Valued Associate #679: Cesar Manara
Planned maintenance scheduled April 23, 2019 at 23:30 UTC (7:30 pm US/Eastern)
Data science time! April 2019 and salary with experience
The Ask Question Wizard is Live!Possible to use share internal files (e.g. using FileProvider) within a flex native extension to other appsSecurityException with grantUriPermission when sharing a file with FileProviderFileProvider is queried by a client app with “_data” in projectionFileProvider path creation and BitmapFactory.decodefile problems in AndroidUsing FileProvider cache-path for gmail attachment shows “invalid” errorProblems with FileProviderFileProvider: No data when sending fileFile Provider: Failed to find configured root that contains_data column not available at FileProvider uriandroid getUriForFile fails for external_files_path
.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty height:90px;width:728px;box-sizing:border-box;
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
<application
...
<provider
android:name="android.support.v4.content.FileProvider"
android:grantUriPermissions="true"
android:exported="false"
android:authorities="$applicationId">
<meta-data
android:name="android.support.FILE_PROVIDER_PATHS"
android:resource="@xml/filepath"/>
</provider>
</application>
There is filepath.xml
<paths>
<files-path
name="logs"
path="logs/" /></paths>
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.
android android-intent android-fileprovider internal-storage android-internal-storage
add a comment |
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
<application
...
<provider
android:name="android.support.v4.content.FileProvider"
android:grantUriPermissions="true"
android:exported="false"
android:authorities="$applicationId">
<meta-data
android:name="android.support.FILE_PROVIDER_PATHS"
android:resource="@xml/filepath"/>
</provider>
</application>
There is filepath.xml
<paths>
<files-path
name="logs"
path="logs/" /></paths>
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.
android android-intent android-fileprovider internal-storage android-internal-storage
add a comment |
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
<application
...
<provider
android:name="android.support.v4.content.FileProvider"
android:grantUriPermissions="true"
android:exported="false"
android:authorities="$applicationId">
<meta-data
android:name="android.support.FILE_PROVIDER_PATHS"
android:resource="@xml/filepath"/>
</provider>
</application>
There is filepath.xml
<paths>
<files-path
name="logs"
path="logs/" /></paths>
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.
android android-intent android-fileprovider internal-storage android-internal-storage
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
<application
...
<provider
android:name="android.support.v4.content.FileProvider"
android:grantUriPermissions="true"
android:exported="false"
android:authorities="$applicationId">
<meta-data
android:name="android.support.FILE_PROVIDER_PATHS"
android:resource="@xml/filepath"/>
</provider>
</application>
There is filepath.xml
<paths>
<files-path
name="logs"
path="logs/" /></paths>
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.
android android-intent android-fileprovider internal-storage android-internal-storage
android android-intent android-fileprovider internal-storage android-internal-storage
asked Mar 22 at 14:55
Artem WinokurovArtem Winokurov
104
104
add a comment |
add a comment |
1 Answer
1
active
oldest
votes
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:
<files-path
name="logs"
path="logs/" />
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.
It works! Thank You a lot! I hate my inattention. So much time lost.
– Artem Winokurov
Mar 22 at 15:16
add a comment |
Your Answer
StackExchange.ifUsing("editor", function ()
StackExchange.using("externalEditor", function ()
StackExchange.using("snippets", function ()
StackExchange.snippets.init();
);
);
, "code-snippets");
StackExchange.ready(function()
var channelOptions =
tags: "".split(" "),
id: "1"
;
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function()
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled)
StackExchange.using("snippets", function()
createEditor();
);
else
createEditor();
);
function createEditor()
StackExchange.prepareEditor(
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader:
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
,
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
);
);
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55302344%2ffileprovider-always-throws-iae%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
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:
<files-path
name="logs"
path="logs/" />
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.
It works! Thank You a lot! I hate my inattention. So much time lost.
– Artem Winokurov
Mar 22 at 15:16
add a comment |
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:
<files-path
name="logs"
path="logs/" />
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.
It works! Thank You a lot! I hate my inattention. So much time lost.
– Artem Winokurov
Mar 22 at 15:16
add a comment |
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:
<files-path
name="logs"
path="logs/" />
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.
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:
<files-path
name="logs"
path="logs/" />
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.
answered Mar 22 at 15:01
CommonsWareCommonsWare
784k14019041954
784k14019041954
It works! Thank You a lot! I hate my inattention. So much time lost.
– Artem Winokurov
Mar 22 at 15:16
add a comment |
It works! Thank You a lot! I hate my inattention. So much time lost.
– Artem Winokurov
Mar 22 at 15:16
It works! Thank You a lot! I hate my inattention. So much time lost.
– Artem Winokurov
Mar 22 at 15:16
It works! Thank You a lot! I hate my inattention. So much time lost.
– Artem Winokurov
Mar 22 at 15:16
add a comment |
Thanks for contributing an answer to Stack Overflow!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55302344%2ffileprovider-always-throws-iae%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown