apache / cordova-plugin-camera

Apache Cordova Plugin camera
https://cordova.apache.org/
Apache License 2.0
967 stars 1.55k forks source link

Unable to select image from gallery on Android 10 #714

Closed 0mpurdy closed 3 years ago

0mpurdy commented 3 years ago

Bug Report

Problem

For a brand new Ionic app, selecting an image from the gallery does not display anything.

What is expected to happen?

Image should be visible in the app (as it is in versions 9 and 11)

What does actually happen?

Image fails to display

Information

I am testing on an emulator as that is the only way I have to test Android 10, but users have reported issues on physical devices.

Command or Code

Minimal Repo:

https://github.com/0mpurdy/cordova-camera

Android 9 Android 10 Android 11
image Untitled image

Environment, Platform, Device

Android 10 emulator confirmed with above repo

Version information

Ionic:

   Ionic CLI                     : 6.13.1 (C:\Users\Work\AppData\Roaming\npm\node_modules\@ionic\cli)
   Ionic Framework               : @ionic/angular 5.6.0
   @angular-devkit/build-angular : 0.1102.4
   @angular-devkit/schematics    : 11.2.4
   @angular/cli                  : 11.2.4
   @ionic/angular-toolkit        : 3.1.1

Cordova:

   Cordova CLI       : 10.0.0
   Cordova Platforms : not available
   Cordova Plugins   : not available

Utility:

   cordova-res : not installed
   native-run  : 1.3.0

System:

   Android SDK Tools : 26.1.1 (T:\android-studio-sdk)
   NodeJS            : v12.18.3 (C:\Program Files\nodejs\node.exe)
   npm               : 6.14.6
   OS                : Windows 10

Checklist

PieterVanPoyer commented 3 years ago

Hi

I did run your reproduction repo. An Android 10 device also fails to show the selected image in my tests.

In my opinion this bug originates from the Ionic codebase. The error is thrown from Ionics WebViewLocalServer. I suggest you try to file an issue by Ionic. ( https://github.com/ionic-team/ionic-framework/issues )

If you think this is wrong you should make a plain Cordova reproduction project. Not an Ionic reproduction project.

image

Some Logcat logging from my test: E/WebViewAssetServer: Unable to open asset URL: http://localhost/_app_file_/storage/emulated/0/DCIM/Camera/IMG_20210319_201640.jpg 2021-03-19 22:10:23.425 2207-2552/com.android.systemui D/EGL_emulation: eglMakeCurrent: 0xe3671500: ver 3 1 (tinfo 0xc17b62e0) 2021-03-19 22:10:23.433 10678-10856/io.ionic.starter E/WebViewAssetServer: Unable to open asset URL: http://localhost/_app_file_/storage/emulated/0/DCIM/Camera/IMG_20210319_201640.jpg 2021-03-19 22:10:23.437 10678-10856/io.ionic.starter E/WebViewAssetServer: Unable to open asset URL: http://localhost/_app_file_/storage/emulated/0/DCIM/Camera/IMG_20210319_201640.jpg

Kind regards Pieter

nicolashenry commented 3 years ago

If it can help, adding this to config.xml seems to help for me:

<edit-config file="app/src/main/AndroidManifest.xml" mode="merge" target="/manifest/application">
    <application android:requestLegacyExternalStorage="true" />
</edit-config>
PieterVanPoyer commented 3 years ago

@0mpurdy Hi

Most likely this bug originates from the Ionic codebase The error is thrown from Ionics WebViewLocalServer. (see my previous comment) Did you file an issue by Ionic. ( https://github.com/ionic-team/ionic-framework/issues )

Kind regards

PieterVanPoyer commented 3 years ago

Closing tickets due to lack of response.

PieterVanPoyer commented 3 years ago

Closing tickets due to lack of response.