DmcSDK / cordova-plugin-mediaPicker

cordova android ios mediaPicker support selection of multiple image and video gif ✨ cordova android 和 ios 图片视频选择cordova插件,支持多图 视频 gif,ui类似微信
MIT License
139 stars 93 forks source link

Android 10 not support #118

Closed renatodolza closed 10 months ago

renatodolza commented 3 years ago

Android 10 not show thumb and not selection after done. mediaPicker_android10_final

Mr-Anonymous commented 3 years 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" />
Mr-Anonymous commented 3 years ago

Also see: https://github.com/DmcSDK/cordova-plugin-mediaPicker/issues/115

Mr-Anonymous commented 3 years ago

Hope there is a fix for this now that targetSdkVersion 29 is required.

SchoolsUnited commented 3 years ago

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

Mr-Anonymous commented 3 years ago

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?

SchoolsUnited commented 3 years ago

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

Mr-Anonymous commented 3 years ago

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?

Mr-Anonymous commented 3 years ago

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.

zoranmil commented 3 years ago

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>

dimitriadamou commented 3 years ago

@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.

21pg commented 2 years ago

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...

SqJiggly commented 2 years ago

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

itbeyond commented 2 years ago

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.

DmcSDK commented 10 months ago

uninstall old plugin,use new version ,Remember to add jitpack.io in the repositories.gradle file, see readme for details