【问题标题】:Android Emulator UI doesn't respond to inputAndroid Emulator UI 不响应输入
【发布时间】:2012-10-30 10:23:54
【问题描述】:

我刚刚在我的 OSX (10.7.4) 上安装了 Android SDK(修订版 20.0.3),因为我想运行 Android Emulator 只是为了使用 Android 浏览器测试我的基于 Web 的移动应用程序。

我下载了 SDK,运行了包更新管理器等,然后通过 GUI 为 2.2 设置了一个 Android 虚拟设备,我可以成功启动模拟器,但它似乎根本没有响应任何输入。我点击 UI 触摸屏或键盘/主页/菜单按钮等,Android 模拟器没有响应。我什至无法打开浏览器或做任何事情。谁能提出问题可能是什么?

任何帮助将不胜感激。

【问题讨论】:

  • 您能告诉我您的 avd(Android 虚拟设备)的设置吗?我假设您也尝试过从头开始重新创建它?
  • 另外,我真的建议您尝试设置其中一个 x86 仿真器映像,arm 仿真真的很慢,而且根据我的经验,它比 arm 映像更容易出错。您还需要安装 HAXM 以进一步加快速度并启用 GPU 加速。最后,我总是给它一些 SDCard 空间。 developer.android.com/tools/devices/emulator.html 如果由于某种原因这些都不适合你,你可能想试试androvm.org/blog
  • @PaulHarris 这是我的 AVD 的设置。请注意,我设置的 2 个 avd 的行为相同(一个用于 2.2,一个用于 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/
  • 我在启用 GPU 加速时看到了同样的情况。不理想,但禁用它应该可以解决它。

标签: android macos mobile android-emulator emulation


【解决方案1】:

您是否尝试过包含 Zepto.js 而不是标准的 Javascript 库而不是普通的 Jquery.js 文件?

它的响应速度要快得多,因为它是一个轻量级的包,可以在慢速的 Android 模拟器上发光。

为了测试您的点击事件并加快点击响应,请包含来自 fwebdev 的 fastclick.js

如果两者都不起作用,请尝试 Dolphin 浏览器: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();
})

【讨论】:

  • 实际的 Android 模拟器根本不响应任何输入。我什至无法打开 Android 浏览器来测试我的应用程序。所以问题与我正在使用的工具包/库无关。这是 Android 模拟器本身的问题。
  • 为同样的问题来到这里得到了一些 jquery shill
猜你喜欢
  • 1970-01-01
  • 2015-12-10
  • 2021-05-21
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2014-05-31
  • 1970-01-01
相关资源
最近更新 更多