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) #602

Closed
ftcaeappno opened this issue Sep 20, 2022 · 4 comments
Closed

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

ftcaeappno opened this issue Sep 20, 2022 · 4 comments

Comments

@ftcaeappno
Copy link

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)`

We did an additional testing:
Screen Shot 2022-09-16 at 12 16 35 PM (2)

  1. After updating chrome (webView) version from 79 to 105 didn't resolve the issue.
  2. The app runs fine without this issue after removing SF Cordova plugin.

The error is also in the attached file.

Is there a documented incompatibility between SalesforceMobileSDK-CordovaPlugin and Android 9?

@gkotula
Copy link

gkotula commented Sep 22, 2022

Hi, did you create your app using forcehybrid? I just used the latest 10.1.1 version of the SDK with forcehybrid and the hybrid_local option to create a new app, installed it on an Android 9 emulator, and I was able to run it just fine.

@ftcaeappno
Copy link
Author

Project is build with Ionic, Angular, & Cordova. Not created using forcehybrid.

Ionic:
   Ionic CLI                     : 6.20.1 (.../@ionic/cli/lib/node_modules/@ionic/cli)
   Ionic Framework               : @ionic/angular 6.0.10
   @angular-devkit/build-angular : 13.2.5
   @angular-devkit/schematics    : 13.2.5
   @angular/cli                  : 13.2.5
   @ionic/angular-toolkit        : 6.1.0

Cordova:
   Cordova CLI       : 10.0.0 (cordova-lib@10.1.0)
   Cordova Platforms : android 9.0.0, ios 6.1.1
   Cordova Plugins   : cordova-plugin-ionic-keyboard 2.2.0, cordova-plugin-ionic-webview 4.2.1, (and 16 other plugins)

Utility:
   cordova-res : 0.15.4
   native-run  : 1.7.0

System:
   Android SDK Tools : 26.1.1 (~/Library/Android/sdk)
   ios-sim           : 8.0.2
   NodeJS            : v16.15.1 (~/node/16.15.1/bin/node)
   npm               : 8.11.0
   OS                : macOS Monterey
   Xcode             : Xcode 13.4.1 Build version 13F100

This issue is caused by angular build step adding with type="module". When type="module" is manually removed this error goes away.
This issue is only happening when Salesforce Cordova plugin is present, Without it <script type="module"> is not an issue on android 9

@wmathurin
Copy link
Contributor

If you are loading from file protocol you can’t use modules because file protocol doesn't provide any mime type and modules need to know the mime type. It's being discussed here and there and many other places.

Closing issue since it's not a limitation with Mobile SDK.

@sinothomasAppno
Copy link

sinothomasAppno commented Sep 28, 2022

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

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