Closed renatodolza closed 10 months ago
This seems to the same issue as this: https://github.com/DmcSDK/cordova-plugin-mediaPicker/issues/110
Does changing target SDK version to 28 help?
<preference name="android-targetSdkVersion" value="28" />
Hope there is a fix for this now that targetSdkVersion
29 is required.
from: https://developer.android.com/about/versions/11/privacy/storage
Apps that run on Android 11 but target Android 10 (API level 29) can still request the requestLegacyExternalStorage attribute. This flag allows apps to temporarily opt out of the changes associated with scoped storage, such as granting access to different directories and different types of media files. After you update your app to target Android 11, the system ignores the requestLegacyExternalStorage flag.
in config.xml
from: https://developer.android.com/about/versions/11/privacy/storage
Apps that run on Android 11 but target Android 10 (API level 29) can still request the requestLegacyExternalStorage attribute. This flag allows apps to temporarily opt out of the changes associated with scoped storage, such as granting access to different directories and different types of media files. After you update your app to target Android 11, the system ignores the requestLegacyExternalStorage flag.
in config.xml
So we need to add something to the config.xml
? What is the solution for this?
i see my post was cut off... [edit] i forgot to wrap the code [/edit]
<edit-config file="app/src/main/AndroidManifest.xml" mode="merge" target="/manifest/application">
<application android:requestLegacyExternalStorage="true" />
</edit-config>
this only works until api level 30 is mandatory probabely somewhere near the end of next year
Hi @SchoolsUnited Thanks for the update. Just last week I released my app with the new targetSDKVersion
set to 29 and since then quite a few users have reported the same issue from Android where they are unable to view the thumbnails although they can open the gallery. I tried adding your suggested code to the config.xml
so requestLegacyExternalStorage="true"
is set. But after adding the above code to config.xml
, I receive a build error when trying to build the app for android:
error: attribute 'android:requestLegacyExternalStorage' not found.
I read in SO that this is because of adding android:requestLegacyExternalStorage
and I should set targetSdkVersion
to 29 as well. However, when I add <preference name="android-compileSdkVersion" value="29" />
to config.xml
, it is still getting ignored. How did you resolve the build error when you added your above code in config.xml
?
I have resolved this by updating to Cordova Android 9.0.0 (from 7.0.0) and then updating the Android SDK Command-line Tools to the latest version by installing this update from the Android Studio. After that I was able to build the App with the android:requestLegacyExternalStorage
attribute.
Thanks for the solution. I will resubmit this to the Play Store and hopefully this resolves the issue to my users.
open plugin.xml
add line
<config-file target="AndroidManifest.xml" parent="application">
<provider android:authorities="${applicationId}.provider" android:exported="false" android:usesCleartextTraffic="true" android:grantUriPermissions="true" android:name="android.support.v4.content.FileProvider">
<meta-data android:name="android.support.FILE_PROVIDER_PATHS" android:resource="@xml/provider_paths" />
</provider>
</config-file>
@zoranmil what should the content be for @xml/provider_paths
?
I have been having an issue with my app where the photo gallery has black-boxes, however on my phone it is fine so I would LOVE to know what is triggering it.
I have tried adding a Provider into my AndroidManifest.xml and a provder_paths.xml
file under res/xml/
with the following content which did not help unfortunately
<?xml version="1.0" encoding="utf-8"?>
<paths xmlns:android="http://schemas.android.com/apk/res/android">
<external-path name="external_files" path="."/>
</paths>
I have noticed that the project source that is from https://github.com/DmcSDK/MediaPickerPoject has a file provider https://github.com/DmcSDK/MediaPickerPoject/blob/master/mediapicker/src/main/AndroidManifest.xml so perhaps DmcSDK
needs to be modified instead? I would branch the project but I can't replicate the issue on my device, happy to work with someone who does have this issue.
Can anybody confirm this plugin works with android 11 changes, for Android API 30. ??
FAILURE: Build failed with an exception.
* What went wrong:
Could not determine the dependencies of task ':app:lintVitalRelease'.
> Could not resolve all artifacts for configuration ':app:debugCompileClasspath'.
> Could not find any matches for com.dmcBig:mediapicker:+ as no versions of com.dmcBig:mediapicker are available.
Required by:
project :app
I am not able to build App if i add this plugin, Is there any alternative for this plugin which works for android 11 and android api 30...
Can anybody confirm this plugin works with android 11 changes, for Android API 30. ??
FAILURE: Build failed with an exception. * What went wrong: Could not determine the dependencies of task ':app:lintVitalRelease'. > Could not resolve all artifacts for configuration ':app:debugCompileClasspath'. > Could not find any matches for com.dmcBig:mediapicker:+ as no versions of com.dmcBig:mediapicker are available. Required by: project :app
I am not able to build App if i add this plugin, Is there any alternative for this plugin which works for android 11 and android api 30...
can you solve it
To get the project to compile under API 30 you need to add a file in the projects platforms - android folder called build-extras.gradle the contents of this file as:
repositories {
google()
mavenCentral()
jcenter()
}
dependencies {
implementation 'com.dmcBig:mediapicker'
}
This will allow the build process to find the dependency and compile.
uninstall old plugin,use new version ,Remember to add jitpack.io in the repositories.gradle file, see readme for details
Android 10 not show thumb and not selection after done.