Skip to content
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

App crashes on Android 9 (device and emulator) #609

Closed
ftcaeappno opened this issue Oct 19, 2022 · 5 comments
Closed

App crashes on Android 9 (device and emulator) #609

ftcaeappno opened this issue Oct 19, 2022 · 5 comments

Comments

@ftcaeappno
Copy link

Creating this ticket since the original (602) was closed. #602

We are developing an app using SalesforceMobileSDK-CordovaPlugin and recently found an issue with Android 9.
This is the error we are getting:
`I/chromium: [INFO:CONSOLE(0)] "Failed to load module script: The server responded with a non-JavaScript MIME type of "". Strict MIME type checking is enforced for module scripts per HTML spec.", source: file:///android_asset/www/runtime.js (0)

I/chromium: [INFO:CONSOLE(0)] "Failed to load module script: The server responded with a non-JavaScript MIME type of "". Strict MIME type checking is enforced for module scripts per HTML spec.", source: file:///android_asset/www/polyfills.js (0)

I/chromium: [INFO:CONSOLE(0)] "Failed to load module script: The server responded with a non-JavaScript MIME type of "". Strict MIME type checking is enforced for module scripts per HTML spec.", source: file:///android_asset/www/main.js (0)`

This project has cordova-plugin-ionic-webview plugin installed.

After some more debugging I think the issue is in SalesforceDroidGapActivity.java L472 where startUrl is hardcoded to file:///android_asset/www/. So even if cordova-plugin-ionic-webview plugin is installed and https:// is available, webview gets redirected to file:///android_asset/www/.

Then, App shows Blank screen with console error Failed to load module script: The server responded with a non-JavaScript MIME type of "". Strict MIME type checking is enforced for module scripts per HTML spec.", source: file:///android_asset/www/runtime.js

@wmathurin
Copy link
Contributor

The code you pointed to is in loadLocalStartPage(). There is also a loadRemoteStartPage() method which loads the start page read in the bootconfig without prepending anything.
To have that method used, you need to set isLocal in your bootconfig file to false.

@ftcaeappno
Copy link
Author

@wmathurin thank you for the prompt response. We'll check and let you know.

@sinothomasAppno
Copy link

sinothomasAppno commented Oct 27, 2022

Thanks @wmathurin #609 (comment) fixed the issue.

@brandonpage
Copy link
Contributor

Thanks for confirming the issue is fixed!

@sinothomasAppno
Copy link

@wmathurin Solution in #609 (comment) breaks the auth flow when user is opening the app after logged in once. I believe this is because changing isLocal from true to false has other impacts.

Found working solution in PR #605.

@wmathurin any ideas why this PR was closed without merge. I think without changes in this PR this plugin doesnot work with cordova-android:10.x.x. Unless a fix for this already added in another PR.

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

No branches or pull requests

4 participants