Skip to Content

Uncaught Error: The specified component controller 'opensap.myapp.Component' could not be found!

Hello experts,

I'm currently in the process of creating a SAP Fiori mobile app. I mobilized the app using HAT, which worked perfectly, and imported the corresponding Android platform build into Android Studio. When I try to run the app, the splash screen shows up on the device screen, but after that it just shows a white screen. When debugging I noticed this error:

I'm pretty new to SAPUI5 and Cordova, but I assume this means that my Component.js file isn't getting initialized? I double checked the name of the component and this seems to be fine.

Component.js:

sap.ui.define([
   "sap/ui/core/UIComponent"
], function (UIComponent) {
   "use strict";

   return UIComponent.extend("opensap.myapp.Component", {

      metadata : {
         manifest: "json"
      },

      init : function () {
         // call the init function of the parent
         UIComponent.prototype.init.apply(this, arguments);
         // additional initialization can be done here
         this.getRouter().initialize();
      }

   });
});

index.html:

<!DOCTYPE html>
<html>
   <head>
      <meta http-equiv="X-UA-Compatible" content="IE=edge" />
      <meta charset="UTF-8">
      <title>MobileEventApp</title>
      
      <script
         id="sap-ui-bootstrap"
         src="https://sapui5.hana.ondemand.com/resources/sap-ui-core-dbg.js"
         data-sap-ui-theme="sap_bluecrystal"
         data-sap-ui-libs="sap.m"
         data-sap-ui-compatVersion="edge"
         data-sap-ui-preload="async"
         data-sap-ui-resourceroots='{"opensap.myapp": "./"}'>
      </script>

      <script>
         sap.ui.getCore().attachInit(function () {
            new sap.ui.core.ComponentContainer({
               name : "opensap.myapp"
            }).placeAt("content");
         });
      </script>

   </head>
   <body class="sapUiBody" id="content">
   </body>

</html>

Project structure:

I'm not really sure how to continue. Does anyone have a solution for this?

component-dbg.png (15.0 kB)
structure.png (11.2 kB)
Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

1 Answer

  • Apr 16 at 08:24 PM
    src="https://sapui5.hana.ondemand.com/resources/sap-ui-core.js"
    
    can you use that in the html?

    Add comment
    10|10000 characters needed characters exceeded

    • EDIT: Nevermind, I got it to work by using src="../resources/sap-ui-core-dbg.js"

      Hi Jun,

      Thank you for your response. I tried referencing your suggested CDN link, but it still doesn't work. I also tried referencing the local resources folder, without success.

      I tried using a different device however, and now I get an error stating that sap is not defined in my index.html. Again I tried using:

      "https://sapui5.hana.ondemand.com/resources/sap-ui-core.js"
      "https://sapui5.hana.ondemand.com/resources/sap-ui-core-dbg.js"<br>
      "../resources/sap-ui-core.js"
      "../resources/sap-ui-core-dbg.js"
      But all without success.