-1

I got an error when initiating sap ui program, please help

manifest.json

"sap.ui5": {
    "rootView": {
        "viewName": "latihan1.view.App",
        "type": "XML"
    },
    "dependencies": {
        "minUI5Version": "1.30.0",
        "libs": {
            "sap.ui.core": {},
            "sap.m": {},
            "sap.f": {},
            "sap.ui.layout": {}
        }
    },
    "config": {
        "fullWidth": true
    },
    "contentDensities": {
        "compact": true,
        "cozy": true
    },

and index.html

<html>
    <head>
        <meta http-equiv="X-UA-Compatible" content="IE=edge" />
        <meta charset="UTF-8">

        <title>latihan1</title>

        <script id="sap-ui-bootstrap"
            src="../../resources/sap-ui-core.js"
            data-sap-ui-libs="sap.ui.core, sap.m, sap.f, sap.ui.layout"
            data-sap-ui-theme="sap_belize"
            data-sap-ui-compatVersion="edge"
            data-sap-ui-resourceroots='{"latihan1": ""}'>
        </script>

and component.js

sap.ui.define([
    "sap/ui/core/UIComponent",
    "sap/ui/Device",
    "latihan1/model/models",
    "sap/f/library"
], function(UIComponent, Device, models, library) {
    "use strict";

    return UIComponent.extend("latihan1.Component", {

        metadata: {
            manifest: "json"
        },

        /**
         * The component is initialized by UI5 automatically during the startup of the app and calls the init method once.
         * @public
         * @override
         */
        init: function() {
            // call the base component's init function
            UIComponent.prototype.init.apply(this, arguments);
            
            // enable routing
            this.getRouter().initialize();

            // set the device model
            this.setModel(models.createDeviceModel(), "device");
        }
    });

enter image description here

The library already loaded

enter image description here

Boghyon Hoffmann
  • 17,103
  • 12
  • 72
  • 170
samin
  • 77
  • 7
  • Can you post your complete manifest.json? I guess essential information is missing – Marc Dec 01 '21 at 09:49
  • Does this answer your question? [The specified class for router or targets 'sap.f.routing.Router' is undefined](https://stackoverflow.com/questions/53143810/the-specified-class-for-router-or-targets-sap-f-routing-router-is-undefined) – Boghyon Hoffmann Dec 01 '21 at 15:24
  • the sapui is 1.52 – samin Dec 02 '21 at 10:43
  • @samin Do you get the same result if you launch the app with `src="https://openui5.hana.ondemand.com/resources/sap-ui-core.js"` in `index.html`? – Boghyon Hoffmann Dec 03 '21 at 19:05

1 Answers1

0

You can remove the sap/f/library inside the dependencies of your Component. Can you try that? Having them in the manifest inside the libs is enough. You don't even need those inside the index file as well.

However what seems be missing in your manifest.json file is the router class under sap.ui5 section.

"routing": {
    "config": {
        "routerClass": "sap.f.routing.Router"
    }
fabiopagoti
  • 1,467
  • 14
  • 31