Abraham Mathew
Abraham Mathew

Reputation: 2146

java.io.IOException: No such device Error in Android 11

FileChannel src = new FileInputStream(source).getChannel();
FileChannel dst = new FileOutputStream(destination).getChannel();
dst.transferFrom(src, 0, src.size());  

src path is --> /storage/emulated/0/Pictures/IMG_20210630_182546.jpg

this is destination folder --> /storage/emulated/0/Android/data/com.tp.qa/files/temp

destination image name --> /gallery1625059659.jpg

Is there some problem in copying file from the above source?

Upvotes: 0

Views: 1004

Answers (1)

Noban Hasan
Noban Hasan

Reputation: 713

In android 11 directly accessing storage is not Allowed. Here is the documentation how to use scoped permission in Android 11. You can try out this solution. In my case this worked.

Upvotes: 1

Related Questions