SailingSteve opened a new issue, #1644:
URL: https://github.com/apache/cordova-android/issues/1644
# Bug Report
## Problem
Using Android 12, I can't load javascript or css files within my app. My
app has been in in the Google and Apple stores for 4 years and is working fine.
This same code and configuration works fine for iOS.
### What is expected to happen?
Tried to load jQuery (as an example) from index.html and when that failed, I
tried to load it from index.js after the deviceready event had fired. Both
experiments failed.
### What does actually happen?
Both fail with a `Failed to load resource: net::ERR_CONNECTION_REFUSED`
## Information
To simplify reproduction, I built the "get ready" example.
### Command or Code
% cordova create test2023b
% cd test2023b
% cordova platform add android
Added to config.xml: `<preference name="android-buildToolsVersion"
value="34.0.0" />`
% cordova run android
The app starts in the simulator, but the console.log reports:
`cordova_plugins.js:1 Failed to load resource:
net::ERR_CONNECTION_REFUSED`
`index.js:27 Running [email protected]`
`favicon.ico:1 Failed to load resource:
net::ERR_CONNECTION_REFUSED`
I added "'unsafe-inline' 'unsafe-eval'" to the "Get Started"
Content-Security-Policy in index.html, but there was no change.
I have a CSP that is currently working in my released app with 6 month old
libraries.
Using this "released" CSP had no effect:
<meta http-equiv="Content-Security-Policy" content="
default-src * wevotetwitterscheme: data: content: gap:
https://ssl.gstatic.com;
img-src * https://*.twimg.com https://*.twitter.com/ data: https:
blob: android-webview-video-poster: ;
style-src * https://*.twimg.com 'unsafe-inline';
script-src 'self' http://* 'unsafe-inline' 'unsafe-eval';
frame-src http://*.facebook.com https://*.facebook.com
https://*.facebook.com https://*.twitter.com https://twitter.com
https://*.vimeo.com https://*.googlevideo.com https://*.youtube.com gap:
'unsafe-inline';
child-src gap://* ;
font-src *;
media-src *;
" />
Then I tried an experiment to load jQuery from index.html by adding
`<script
src="https://ajax.googleapis.com/ajax/libs/jquery/3.5.1/jquery.min.js"></script>`
before the `</body>`
And the results from the console log were:
` cordova_plugins.js:1 Failed to load resource:
net::ERR_CONNECTION_REFUSED`
` cordova.js:1237 deviceready has not fired after 5 seconds.`
` cordova.js:1230 Channel not fired: onDOMContentLoaded`
` jquery.min.js:1 Failed to load resource:
net::ERR_NAME_NOT_RESOLVED`
` index.js:27 Running [email protected]`
` favicon.ico:1 GET https://localhost/favicon.ico
net::ERR_CONNECTION_REFUSED`
I also tried adding
`<access origin="https://ajax.googleapis.com/*" />`
`<access origin="https://localhost/*" />`
with no effect.
### Environment, Platform, Device
Mac OS 13.4.1 (c)
Simulator for a Pixel 6 Pro
### Version information
12.0.0 ([email protected])
android 12.0.0
For this example: no plugins, plain Cordova, and only Android from a CLI
"run" with no Android Studio.
## Checklist
- [x] I searched for existing GitHub issues
- [x] I updated all Cordova tooling to most recent version
- [x] I included all the necessary information above
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]