Software Archive
Read-only legacy content
17061 Discussions

Intel is not defined

Tarun_C_
Beginner
639 Views

Hi,

I have built an app hybrid+cordova

It tests fine in test tab, usb debug and app preview without any errors.

In the built version when debugging Android remote with Chrome USB Debug it has as error as follows:

 processMessage failed: Error: ReferenceError: intel is not defined
cordova.js:1059 processMessage failed: Stack: ReferenceError: intel is not defined
    at updateContactsList (file:///android_asset/www/js/app.js:553:5)
    at onSuccess (file:///android_asset/www/js/app.js:521:28)
    at win (file:///android_asset/www/plugins/org.apache.cordova.contacts/www/contacts.js:56:17)
    at Object.cordova.callbackFromNative (file:///android_asset/www/cordova.js:292:54)
    at processMessage (file:///android_asset/www/cordova.js:1053:21)
    at Function.androidExec.processMessages (file:///android_asset/www/cordova.js:1090:13)
    at pollOnce (file:///android_asset/www/cordova.js:955:17)
    at pollOnceFromOnlineEvent (file:///android_asset/www/cordova.js:945:5)

I have no idea where this is coming from or why.

Any thoughts? Any and all help is appreciated.

Cheers

TeaCii

0 Kudos
7 Replies
PaulF_IntelCorp
Employee
639 Views

When your app runs in the Test tab, App Preview or the Debug tab it includes the intel.xdk namespace "for free." That is, the plugins required to make those intel.xdk APIs work are already included in those debug modules.

When you build your app you must be sure to include the plugins that correspond to the APIs you are using. This means you must enable the Cordova and/or XDK plugins that correspond to the intel.xdk namespace APIs you are using. Go to the Projects tab and insure that the plugins you need are selected in the plugins section of the settings. See this doc page for details: https://software.intel.com/en-us/xdk/docs/adding-third-party-plugins-to-your-xdk-cordova-app

0 Kudos
Tarun_C_
Beginner
639 Views

Hi,

That worked very well. Thank you.

This may be a feature request !!! How awesome would it be that the build includes the cordova and intel plugins automatically as it does during debug. You can provide some setting option to turn it off for advanced users.

Thanks again.

TeaCii

0 Kudos
PaulF_IntelCorp
Employee
639 Views

We're working on just that feature, already. :)

0 Kudos
Navin_Kumar_P_
Beginner
639 Views

Hi

I am having the same issue. I checked and confirmed that the plugins are included in the Plugins section of the Projects tab. But still I seem to get this error. It works well in the Emulate tab though. Any suggestions on this will be very helpful. I am using the latest version of the xdk that I downloaded yesterday.

Thanks

 

0 Kudos
Navin_Kumar_P_
Beginner
639 Views

Hi

Please ignore my request...I had only included Cordova device plugin but was using intel.xdk.device. That was the issue.

Thanks

0 Kudos
Sebastian_G_1
Beginner
639 Views

Hi,

I noticed some very weird behaviour, also leading to an "intel not defined"-bug.

I already tried to rule out possible conflicts, so I created a "Blank Cordova Starter App".

I added the plugin "App Security API 2.02", and activated the Android Build Target.

I use XDK Version 3522, CLI 6.2, Target Android API 21, Crosswalk Runtime 19 (Embedded)

 

The only change I made is in the app.js, where I added some code for testing the Security API, and an onerror event handler:

//NOTE: SHOWS ALL JAVASCRIPT ERRORS -> MAKE SURE THIS IS DEACTIVATED IN PRODUCTION MODE
window.onerror = function(msg, url, linenumber) {
    alert('Error message: '+msg+'\nURL: '+url+'\nLine Number: '+linenumber);
    return true;
};

function myEventHandler() {
    "use strict" ;

    var ua = navigator.userAgent ;
    var str ;

    if( window.Cordova && dev.isDeviceReady.c_cordova_ready__ ) {
            str = "It worked! Cordova device ready detected at " + dev.isDeviceReady.c_cordova_ready__ + " milliseconds!" ;
    }
    else if( window.intel && intel.xdk && dev.isDeviceReady.d_xdk_ready______ ) {
            str = "It worked! Intel XDK device ready detected at " + dev.isDeviceReady.d_xdk_ready______ + " milliseconds!" ;
    }
    else {
        str = "Bad device ready, or none available because we're running in a browser." ;
    }
    
    //*****START EXTRA LINES******
    
    intel.security.secureData.createFromData( { data: "TEST" } )

    .then (function (dataInstanceID) {
        return intel.security.secureStorage.write( { id: "ID1", instanceID: dataInstanceID } );
    })

    .then (alert("success"))

    .catch (function(error) {
        alert("Fail, error code is: " + error.code + ", error message is: " + error.message);
    });
    
    //*****END EXTRA LINES******
    
    
    alert(str) ;
}

 

Test-Case 1) Now when I use "Test > Mobile > PUSH TO TESTING SERVER" I will always get the error message:

"Uncaught ReferenceError: intel is not defined..."

Test-Case 2) When I use "Test > Wifi" instead, it works, "success" is shown

Test-Case 3) When I build the Project and install the APK on the device, it works, "success" is shown

 

I just cannot find the logical mistake I may have made...and I doubt there is one, because after all Test-Case 3 works, and I cannot see a real difference between Test-Case 1 and Test-Case 2 either.

So I was thinking, perhaps (since it is a rather big plugin) there might be issues with my internet connection or your testing server, so maybe files get dropped or anything similar, but that also seems unlikely, because when I use the plugin with the real project I am working on, everything else consistently works (no errors, no missing images and so on), except the part where the user is supposed to save his settings/credentials.

I guess I can live with this issue, since the results of Test-Case 2 and Test-Case 3 will be sufficient for further use of the plugin, but well, it's one of those things where you end up asking yourself, if there is some witchcraft involved :p

 

0 Kudos
PaulF_IntelCorp
Employee
639 Views

Check the code in the "my private notes" and "my private photos" examples. Those are both written to use the App Security API. If that doesn't answer your questions I can ask the experts for that API to chime in.

0 Kudos
Reply