Govinda Rajbhar
Govinda Rajbhar

Reputation: 3034

Android build is not working on device?

I am a beginner with Intel XDK New.

I have made some example in Intel XDK New. It is working fine on emulator, but when I build it, it does not work on device.

This time I built an apk for Android. I tested this build on multiple Android devices, but I am getting a blank screen on every Android device.

I am using Intel XDK New version 0505.

My html code:-

<!DOCTYPE html><!--HTML5 doctype-->
<html>
<head>
    <title>Your New Application</title>
    <meta http-equiv="Content-type" content="text/html; charset=utf-8">

    <link rel="stylesheet" href="css/jquery.mobile-1.4.1.min.css"/>
    <script src="js/jquery-1.11.0.min.js"></script>
    <script src="js/jquery.mobile-1.4.1.min.js"></script>
    <script src="intelxdk.js"></script>
    <script src="intelxdk.js"></script>
    <script type="text/javascript">

    var onDeviceReady=function(){
            alert("onDeviceReady");
            intel.xdk.device.hideSplashScreen();
            intel.xdk.contacts.getContacts();
    };

    document.addEventListener("intel.xdk.device.ready",onDeviceReady,false);
    document.addEventListener('intel.xdk.contacts.get', contactsReceived, false);

    function contactsReceived() {
        alert("contactsReceived");
        var table = document.getElementById("contacts");
        table.innerHTML = '';
        var myContacts = intel.xdk.contacts.getContactList();
        for(var i=0;i<myContacts.length;i++) {
            //add row to table
            var contactInfo = intel.xdk.contacts.getContactData(myContacts[i]);
            var tr = document.createElement("tr");
            tr.setAttribute('id', ''+contactInfo.id);
            tr.setAttribute('onClick', 'document.getElementById("iden").value = '+contactInfo.id+';');
            tr.setAttribute('style', 'background-color:#B8BFD8');
            var id = document.createElement("td");
            id.innerHTML = contactInfo.id;
            tr.appendChild(id);
            var msg = document.createElement("td");
            msg.innerHTML = contactInfo.name;
            alert("Contact Number:-" + contactInfo.id + " And Name:-"+contactInfo.name);
            tr.appendChild(msg);
            table.appendChild(tr);
        }
    }      
</script>

</head>
<script src="http://debug-software.intel.com/target/target-script-min.js#u60fxdYP_QtTsFJTyfFeg5qjPPAjg-Pmn1MrrjVlZW8"></script>
<body>
    <div>
        <table id="contacts" border="bold" width="100%" >
        </table>
    </div>
</body>
</html>

Above code is working fine on emulator.But it is not working on device after build.

Why do I have this problem?

Upvotes: 2

Views: 1309

Answers (1)

krisrak
krisrak

Reputation: 12952

You have included intelxdk.js script 2 times, remove one and it will work, I just verified this.

Upvotes: 1

Related Questions