0

Unable to read captured image from
"path /external_files/Android/data/com.test.testt/files/test_CAM_20230328_172047.jpg"

**Existing code **

Intent intent = new Intent(MediaStore.ACTION_IMAGE_CAPTURE);
                    intent.putExtra(MediaStore.EXTRA_OUTPUT, GeneralFunctions.setImageUri(DocActivity.this));
                    startActivityForResult(intent, ConstantVariables.IMAGE_REQUEST_CODE);

**image uri**
File mainFolder = null;         
    if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.R) {     
        mainFolder = Environment.getExternalStoragePublicDirectory(Environment.DIRECTORY_PICTURES);  
       } else {         
    mainFolder = Environment.getExternalStorageDirectory()
}

        if (Build.VERSION.SDK_INT < Build.VERSION_CODES.N) {
            imgUri = Uri.fromFile(file);
        }else {
            imgUri = FileProvider.getUriForFile(context, context.getApplicationContext().getPackageName() + ".provider", file);
            // Log.e("imgUri","imgUriffffffff"+imgUri);
        }

# File Provider

<external-path
        name="external_files"
        path="." />

    <external-path
        name="Download"
        path="Download/" />

It works fine on another device, howver am getting error on VIVO T1 5G [V2141] Device Android 13

Error

  java.lang.IllegalArgumentException: Requested path /external_files/Android/data/com.ttt.inew/files/CAM_20230328_172047.jpg doesn't appear under [/storage/emulated/0]
        at com.android.providers.media.MediaProvider.insert(MediaProvider.java:4755)
        at android.content.ContentProvider$Transport.insert(ContentProvider.java:376)
        at android.content.ContentProviderNative.onTransact(ContentProviderNative.java:168)
        at android.os.Binder.execTransactInternal(Binder.java:1295)
        at android.os.Binder.execTransact(Binder.java:1259)
moken
  • 3,227
  • 8
  • 13
  • 23

1 Answers1

-1

Issue Is With Software? Try These Fixes.

  1. Open the Settings app on your Android device. Go to Apps and select Camera from the list of installed apps. After that, tap on Storage. Then, tap on the Clear cache option.
  2. Go to Settings > Apps and select Camera. Then, tap on Force stop.
  3. If nothing else works, reset your Android device to its default settings as a last resort. Be sure to take a backup before going for this option, as it wipes out all documents, media, contacts, text messages, and everything else stored on your phone.
  • Your answer could be improved with additional supporting information. Please [edit] to add further details, such as citations or documentation, so that others can confirm that your answer is correct. You can find more information on how to write good answers [in the help center](/help/how-to-answer). – Community Apr 03 '23 at 06:51