-
Notifications
You must be signed in to change notification settings - Fork 1.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Failed to load assets image with Version > 10 #1316
Comments
ooph... I think this might be because native code is external from the webview, and There are two workarounds you can try... Remapping https:// paths to local file:// pathsAnything you tell google maps to load can probably be remapped from Basically replace Not really sure if this will work, but it's worth a try. Opting out of WebAssetLoaderYou can tell cordova to opt out of using the |
Currently i'm giving the Google Maps Plugin a Url like The second option, setting the Is this something that the Google Maps Plugin has to fix/migrate? |
Cordova Android 10.x by default will use scheme+hostname. And Cordova-iOS 6.x I believe will always use scheme+hostname. The scheme can not match exactly because of limitations between each platform but the following example should work. But needs to be tested as I do not use this plugin. Setup: Let’s say you have an image uploaded at this directory path.
WebView Paths: With Cordova iOS 6.x default settings, the path would be: With Cordova Android 10.x and default settings, the path would be: Recommendation: Would be recommended to pass in the absolute path, You might also be able to use Catches: Now, not everyone can use the https protocol because they might load external third party resources or api requests to the http scheme and these can’t mix. At least https, a secure protocol can not call and insecure protocol. If you are faced with this issue, in case of Android, you can change the scheme to http. Now for the First try the above recommendation: |
Passing the absoulte Path like
|
Sorry, I was mistaken about where the error was. I thought it was from the WebView side but, I see it was the native side of the plugin. It will need to be the path that @breautek suggested.
But, this path will not work for iOS. Try his other suggestion, to confirm that it will work: Maybe the correct solution would involve a change/feature request to the plugin developers. Since you are passing the path to the plugin, and the plugin is trying to fetch the file with native code, maybe the plugin should accept various string values and determine the correct path. E.g. Various String Values:
Maybe, there could be something implemented on our platform's code to help translate the file paths to native paths, etc, but then it would include app developers updating the app code and wrap file paths. For some reason, I would feel that this isn't the best solution compared with the plugin change. @breautek any thoughts? |
Yeah the |
Thanks for confirming, i think my suspicions are accurate. When using the web asset loader, the only thing that understands the https://localhost url is the webview itself. Anything external won't be able to use this url.
I think so too, but I'm not quite sure what the solution would be. Native could probably parse the url and transform it to a regular file:// url. I think the cordova plugin class could also provide this url transform implementation. I think this is what @erisu was hinting but wasn't quite recommending. Obviously the problem is plugins will need to be updated, but I'm not sure if there is a way around that. Do you have a similar issue with iOS? I have one app that uses gmaps & custom markers, but it hasn't been updated. If necessarily I can find time to get the latest platforms installed to confirm |
iOS works fine with latest |
@EinfachHans |
This helps and include to install this also |
This is something the plugin needs to handle, not a cordova-android bug |
Bug Report
Problem
I'm currently migrating my project to
cordova-android@10
. In my Project i'm using Googlemaps and Markers that icons are in my assets Folder. These are not working anymore and displays the default Google Map Marker.Information
I see the following Error when i run my App via debugger:
Maybe the migration from the whitelist Plugin is not correctly working?
Environment, Platform, Device
Google Pixel 4, Android 10
Version information
Checklist
The text was updated successfully, but these errors were encountered: