1
votes

I've just installed the Android SDK (Revision 20.0.3) on my OSX (10.7.4) as I want to run the Android Emulator just to test my web based mobile application using the Android browser.

I downloaded the SDK, ran the package update manager etc, then set up an Android Virtual Device for 2.2 via the GUI and I can successfully start up the emulator, but it doesn't seem to respond to any input at all. I click on the UI touch screen or the keyboard/home/menu buttons etc and the Android Emulator just doesn't respond. I can't even open the browser or do anything. Could anyone suggest what the problem might be?

Any help would be appreciated.

1
Can you show me the settings for your avd (Android virtual device)? I assume you have tried recreating it from scratch too? - Paul Harris
Also i really suggest you try to set up one of the x86 emulator images, the arm emulation is really slow and in my experience more buggy than the arm images. You will also want to install HAXM to speed it up even more and enable GPU acceleration. Lastly I always give it some SDCard space. developer.android.com/tools/devices/emulator.html If for some reason none of this works for you, you might want to give androvm.org/blog a try. - Paul Harris
@PaulHarris Here are the settings for my AVD. Note that I get the same behaviour for 2 avd's I set up (one for 2.2 and one for 4.1.2): hw.lcd.density=240 hw.screen=touch skin.name=WVGA800 skin.path=platforms/android-8/skins/WVGA800 hw.cpu.arch=arm abi.type=armeabi hw.keyboard=yes vm.heapSize=24 image.sysdir.1=platforms/android-8/images/ - Manachi
I'm seeing the same thing when I enable GPU acceleration. Not ideal, but disabling that should fix it. - Sean Aitken

1 Answers

-2
votes

Have you tried including Zepto.js instead of the standard Javascript Library instead of the normal Jquery.js file?

It is much faster for response since it is a lighter package that shines on the slow Android Emulator.

For testing your Click Events and to speed up the click response, include fastclick.js from fwebdev

If both do not work, try Dolphin Browser : https://play.google.com/store/apps/details?id=mobi.mgeek.TunnyBrowser&hl=en

https://gist.github.com/2168307

//======================================================== FASTCLICK
function FastButton(element, handler) {
    this.element = element;
    this.handler = handler;
    element.addEventListener('touchstart', this, false);
};
FastButton.prototype.handleEvent = function(event) {
    switch (event.type) {
       case 'touchstart': this.onTouchStart(event); break;
       case 'touchmove': this.onTouchMove(event); break;
       case 'touchend': this.onClick(event); break;
       case 'click': this.onClick(event); break;
    }
 };
FastButton.prototype.onTouchStart = function(event) {
    event.stopPropagation();
    this.element.addEventListener('touchend', this, false);
    document.body.addEventListener('touchmove', this, false);
    this.startX = event.touches[0].clientX;
    this.startY = event.touches[0].clientY;
    isMoving = false;
 };
FastButton.prototype.onTouchMove = function(event) {
    if(Math.abs(event.touches[0].clientX - this.startX) > 10 || Math.abs(event.touches[0].clientY - this.startY) > 10) {
       this.reset();
    }
 };
FastButton.prototype.onClick = function(event) {
    this.reset();
    this.handler(event);
    if(event.type == 'touchend') {
       preventGhostClick(this.startX, this.startY);
    }
 };
FastButton.prototype.reset = function() {
    this.element.removeEventListener('touchend', this, false);
    document.body.removeEventListener('touchmove', this, false);
};
function preventGhostClick(x, y) {
    coordinates.push(x, y);
    window.setTimeout(gpop, 2500);
};
function gpop() {
    coordinates.splice(0, 2);
};
function gonClick(event) {
    for(var i = 0; i < coordinates.length; i += 2) {
       var x = coordinates[i];
       var y = coordinates[i + 1];
       if(Math.abs(event.clientX - x) < 25 && Math.abs(event.clientY - y) < 25) {
          event.stopPropagation();
          event.preventDefault();
       }
    }
};
document.addEventListener('click', gonClick, true);
var coordinates = [];
function initFastButtons() {
    new FastButton(document.getElementById("fastclick"), goSomewhere);
};
function goSomewhere() {
    var theTarget = document.elementFromPoint(this.startX, this.startY);
    if(theTarget.nodeType == 3) theTarget = theTarget.parentNode;
    var theEvent = document.createEvent('MouseEvents');
    theEvent.initEvent('click', true, true);
    theTarget.dispatchEvent(theEvent);
};
//========================================================

//When using jQuery call init on domReady-Event
$(document).ready(function() {
initFastButtons();
})