Android Question Failed to find configured root

JGiunta

Member
Hello,

I'm having trouble with this line of code:
[CODE lang="b4x" title="Create File Provider uri" highlight="8"]Sub CreateFileProviderUri (Dir As String, FileName As String) As Object
Dim FileProvider As JavaObject
Dim context As JavaObject
context.InitializeContext
FileProvider.InitializeStatic("android.support.v4.content.FileProvider")
Dim f As JavaObject
f.InitializeNewInstance("java.io.File", Array(Dir, FileName))
Return FileProvider.RunMethod("getUriForFile", Array(context, Application.PackageName & ".provider", f))
End Sub[/CODE]


The logged error is:
"Caused by: java.lang.IllegalArgumentException: Failed to find configured root that contains /data/data/*PACKAGENAME*/files/shared/AppTest.apk"
(Note that i changed the packagename, but that one is correct)
Could it be that i have two "/data"?

The app has all the permissions and i'm testing it on an Android 7.1.1 device

I've also put this in the manifest
[CODE lang="b4x" title="Manifest"]AddApplicationText(
<provider
android:name="android.support.v4.content.FileProvider"
android:authorities="$PACKAGE$.provider"
android:exported="false"
android:grantUriPermissions="true">
<meta-data
android:name="android.support.FILE_PROVIDER_PATHS"
android:resource="@xml/provider_paths"/>
</provider>
)[/CODE]
 
Back
Top