Closed hiteshsarsava closed 11 months ago
Hi, the issue you are facing is due to the max sdk version for write permission. In my library i have put it as 32 (suggested by Android studio).
You can do either of these two things:
maxSdkVersion
from 28
to 32
if you do not have restrictions.tools:replace="android:maxSdkVersion"
as suggested in error.
android:name="android.permission.WRITE_EXTERNAL_STORAGE"
android:maxSdkVersion="28"
tools:replace="android:maxSdkVersion"/>```
Hi @afreakyelf
1. I can't use first option as Write External will not work after Android 9(SDK 28). Check attached image from official website. Ref
When I put maxSdkVersion 32, I get this warning in studio. Pasted below :
WRITE_EXTERNAL_STORAGE no longer provides write access when targeting Android 10+ More... (βF1) Inspection info:Scoped storage is enforced on Android 10+ (or Android 11+ if using requestLegacyExternalStorage). In particular, WRITE_EXTERNAL_STORAGE will no longer provide write access to all files; it will provide the equivalent of READ_EXTERNAL_STORAGE instead. As of Android 13, if you need to query or interact with MediaStore or media files on the shared storage, you should be using instead one or more new storage permissions: android.permission.READ_MEDIA_IMAGES android.permission.READ_MEDIA_VIDEO * android.permission.READ_MEDIA_AUDIO and then add maxSdkVersion="33" to the older permission. See the developer guide for how to do this: https://developer.android.com/about/versions/13/behavior-changes-13#granular-media-permissions The MANAGE_EXTERNAL_STORAGE permission can be used to manage all files, but it is rarely necessary and most apps on Google Play are not allowed to use it. Most apps should instead migrate to use scoped storage. To modify or delete files, apps should request write access from the user as described at https://goo.gle/android-mediastore-createwriterequest.
2. I used second option but it's give me another error.
Thanks for pointing out. I must have missed it. I will check the first point, meanwhile did you try the second option like this?
android:name="android.permission.WRITE_EXTERNAL_STORAGE" android:maxSdkVersion="28" tools:replace="android:maxSdkVersion"/>
@afreakyelf
I mentioned second option in my above comment. Please check it.
Yes but it says "no new value specified" that's why I asked if you put the snippet correct.
@afreakyelf
I put above snippet but still it gives the error posted above.
Alright. I will take a look as soon as possible thank you! If you dont mind, Can you send a screenshot of your manifest file? If it conflicts with other permissions? because i tried the above snippet in a project with same configuration as yours and it seems to be working.
Hi @hiteshsarsava , Can you try with com.github.afreakyelf:Pdf-Viewer:v2.0.4
, I just released it.
Hi, Closing this as haven't heard from you. Hoping that issue has been resolved. Please feel free to reopen.
Thanks @afreakyelf It solved my issue.
@afreakyelf Can you explain why this library that shows PDF needs android.permission.WRITE_EXTERNAL_STORAGE
and android.permission.READ_EXTERNAL_STORAGE
permission ?
Just to be sure if I can remove these in my merged Manifest.
π Describe the Bug
When updated latest version, It's giving this error for building project.
π Library Version
π Project Version
π Android studio Version
Android Studio Hedgehog | 2023.1.1 Build #AI-231.9392.1.2311.11076708, built on November 9, 2023 Runtime version: 17.0.7+0-17.0.7b1000.6-10550314 x86_64 VM: OpenJDK 64-Bit Server VM by JetBrains s.r.o. macOS 12.7.1 GC: G1 Young Generation, G1 Old Generation Memory: 2048M Cores: 4 Metal Rendering is ON Registry: external.system.auto.import.disabled=true debugger.new.tool.window.layout=true ide.text.editor.with.preview.show.floating.toolbar=false ide.experimental.ui=true ide.images.show.chessboard=true
Non-Bundled Plugins: com.intellij.marketplace (231.9392.3) Dart (231.9409) wu.seal.tool.jsontokotlin (3.7.4) idea.plugin.protoeditor (231.9225.5) dev.polek.adbwifi (1.2.5) izhangzhihao.rainbow.brackets (2023.3.7) io.flutter (76.3.3)
πΆ Steps to Reproduce
Please follow these steps to reproduce the issue: Check attached image
Used this in my project