android-fileprovider

IllegalArgumentException: Failed to find configuration root that contains xxx on FileProvider.getUriForFile

风格不统一 提交于 2019-12-21 03:26:04
问题 I have been trying to follow the Android tutorial on sharing files. I set up the FileProvider like this: On the main manifest xml: <provider android:name="android.support.v4.content.FileProvider" android:authorities="com.example.mysecondapp.fileprovider" android:exported="false" android:grantUriPermissions="true" > <meta-data android:name="android.support.FILE_PROVIDER_PATHS" android:resource="@xml/filepaths" /> </provider> the res/xml/filpaths.xml file: <paths xmlns:android="http://schemas

How to open an APK file for all Android versions

二次信任 提交于 2019-12-19 19:17:11
问题 Background So far, there was an easy way to install an APK file, using this intent: final Intent intent=new Intent(Intent.ACTION_VIEW) .setDataAndType(Uri.fromFile(apkFile), "application/vnd.android.package-archive"); But, if your app targets Android API 24 and above (Nougat - 7.0) , and you run this code on it or newer, you will get an exception, as shown here , for example: android.os.FileUriExposedException: file:///storage/emulated/0/sample.apk exposed beyond app through Intent.getData()

App crashes after reinstall on emulator since FileProvider Class was not found

拥有回忆 提交于 2019-12-19 19:14:16
问题 When I run the app on the emulator it always works on the first try. But when the app is already installed on the emulator it often results in a crash during the start of the app. This behavior started to occur with Android Studio 2.0. It does not occur on devices, therefore it is not so important but only annoying since I always need to delete the app from the emulator before installing a new version. Since I have absolutely no idea what causes this issue and can't find similar issues during

Didn't find class “androidx.core.content.FileProvider”

廉价感情. 提交于 2019-12-19 06:39:11
问题 I migrated my app to AndroidX and it's crashing on launch on API level 21. My application throws this exception: 10-08 09:42:50.930 11346-11346/com.example.test E/AndroidRuntime: FATAL EXCEPTION: main Process: com.example.test, PID: 11346 java.lang.RuntimeException: Unable to get provider androidx.core.content.FileProvider: java.lang.ClassNotFoundException: Didn't find class "androidx.core.content.FileProvider" on path: DexPathList[[zip file "/data/app/com.example.test-1.apk"]

Android file chooser with specific file extensions

∥☆過路亽.° 提交于 2019-12-17 19:44:58
问题 I need to show only 'pdf' files in my application when I run default File chooser I'm not able to filter file extensions. final Intent getContentIntent = new Intent(Intent.ACTION_GET_CONTENT); getContentIntent.setType("application/pdf"); getContentIntent.addCategory(Intent.CATEGORY_OPENABLE); Intent intent = Intent.createChooser(getContentIntent, "Select a file"); startActivityForResult(intent, REQUEST_PDF_GET); File chooser shows any kinds of files. I would like to show only pdf files. How

FileProvider throws exception on GetUriForFile

别来无恙 提交于 2019-12-17 10:57:34
问题 I followed the example code on the android developer reference on FileProviders but it won't work. I have setup the path files/exports/ in the file provider definition in my Manifest and the referenced files does exist at that path. In my Manifest: <provider android:name="android.support.v4.content.FileProvider" android:authorities="com.company.app.fileprovider" android:exported="false" android:grantUriPermissions="true"> <meta-data android:name="android.support.FILE_PROVIDER_PATHS" android

FileProvider - IllegalArgumentException: Failed to find configured root

人走茶凉 提交于 2019-12-17 02:41:46
问题 I'm trying to take a picture with camera, but I'm getting the following error: FATAL EXCEPTION: main Process: com.example.marek.myapplication, PID: 6747 java.lang.IllegalArgumentException: Failed to find configured root that contains /storage/emulated/0/Android/data/com.example.marek.myapplication/files/Pictures/JPEG_20170228_175633_470124220.jpg at android.support.v4.content.FileProvider$SimplePathStrategy.getUriForFile(FileProvider.java:711) at android.support.v4.content.FileProvider

FileProvider Class Unresolved

こ雲淡風輕ζ 提交于 2019-12-14 03:42:56
问题 I am trying to do this tutorial. I have followed all the steps but I am unable to build due to an error stating Unresolved Class FileProvider I have the support repository installed. My current grade is as follows: apply plugin: 'com.android.application' android { compileSdkVersion 26 defaultConfig { applicationId "com.mydomain.example" minSdkVersion 19 targetSdkVersion 26 versionCode 1 versionName "1.0" testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner" } buildTypes {

FileProvider.getUriForFile is causing StringIndexOutOfBoundsException

故事扮演 提交于 2019-12-13 18:24:40
问题 I have updated my project to implement Providers . The whole implementations seem right, but I am receiving a StringIndexOutOfBoundsException exception inside FileProvider class. In my case, an Intent is created, in which, the user will choose between get an image from his library or take a new photo. That is where one of my Intents is created, to after, include in a list, to create a chooser. File file = getTempFile(context); if (file != null) { Intent takePhotoIntent = new Intent(MediaStore

Share audio file from /data/user/0/ directory using FileProvider

五迷三道 提交于 2019-12-13 03:14:36
问题 I'm using FileProvider API for sharing content actually storing in internal storage. Following is my xml configuration that linked with Provider configured in Manifiest file. <paths xmlns:android="http://schemas.android.com/apk/res/android"> <cache-path name="xs_audio" path="/audio/records"/> </paths> and code that I'm using to share is following: private final static String FILE_PROVIDER = BuildConfig.APPLICATION_ID + ".fileprovider"; private String testPackageAppHaveAccess = "com.whats";