Skip to content
This repository has been archived by the owner on Sep 26, 2022. It is now read-only.

Unable to open asset URL on Android #279

Open
Endi327 opened this issue Sep 6, 2022 · 0 comments
Open

Unable to open asset URL on Android #279

Endi327 opened this issue Sep 6, 2022 · 0 comments

Comments

@Endi327
Copy link

Endi327 commented Sep 6, 2022

Describe the bug

I'm building an ionic application and I faced with an issue that affect only the Android devices.

I have some public images that I'd like to load like this:

I'm using this plugin to make API calls, to avoid CORS issues. All the API calls are working on both platforms, but the images only works on iOS.

If I check the inspector this is the error message I get:

Screenshot 2022-09-06 at 12 17 00

If I check the Android Studio logs I see these error messages: E/Capacitor: Unable to open asset URL:

If I'm using axios to make the API calls it works fine on Android but then it'll break on iOS due to CORS issues.

I was trying to separate the API calls and only use the native plugin on iOS but I don't think that is possible.. Android was able to make the calls with axios but even it says 200 OK, the response is always like this instead of JSON:

Screenshot 2022-09-06 at 12 29 44

Android AndroidManifest is extended with this: android:usesCleartextTraffic="true"

webDir: "build", bundledWebRuntime: false, android: { allowMixedContent: true }, server: { cleartext: true, hostname: "baseurl.hu", iosScheme: "localhost", androidScheme: "https" },

To Reproduce
Steps to reproduce the behavior:

  1. Add this plugin to your project
  2. Try to load external public images into an image
  3. on iOS it loads well, on Android it does not.

Expected behavior
Images should load on both platform. I tried to load other public images and non of them worked for me. When I was using axios it worked fine.

Smartphone (please complete the following information):

  • Device: Xiaomi Redmi 9
  • OS: Android 10.0

Additional context
I would be okay with both solutions, use axios on Android and native network calls for iOS OR make Android load images somehow.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant