Android Emulator用户界面没有';不响应输入
我刚刚在我的OSX(10.7.4)上安装了Android SDK(版本20.0.3),因为我想运行Android Emulator,用Android浏览器测试我基于web的移动应用程序 我下载了SDK,运行了软件包更新管理器等,然后通过GUI为2.2安装了一个Android虚拟设备,我可以成功地启动模拟器,但它似乎根本不响应任何输入。我点击UI触摸屏或键盘/主页/菜单按钮等,Android仿真器没有响应。我甚至不能打开浏览器或做任何事情。有人能告诉我问题出在哪里吗Android Emulator用户界面没有';不响应输入,android,macos,mobile,android-emulator,emulation,Android,Macos,Mobile,Android Emulator,Emulation,我刚刚在我的OSX(10.7.4)上安装了Android SDK(版本20.0.3),因为我想运行Android Emulator,用Android浏览器测试我基于web的移动应用程序 我下载了SDK,运行了软件包更新管理器等,然后通过GUI为2.2安装了一个Android虚拟设备,我可以成功地启动模拟器,但它似乎根本不响应任何输入。我点击UI触摸屏或键盘/主页/菜单按钮等,Android仿真器没有响应。我甚至不能打开浏览器或做任何事情。有人能告诉我问题出在哪里吗 任何帮助都将不胜感激。您是否尝
任何帮助都将不胜感激。您是否尝试过将Zepto.js包含在标准Javascript库中而不是普通的Jquery.js文件中 它的响应速度要快得多,因为它是一个更轻的包,在缓慢的Android仿真器上大放异彩 要测试单击事件并加快单击响应,请包括来自fwebdev的fastclick.js 如果两者都不起作用,请尝试海豚浏览器:
/==========================================================================================================================================快速单击
功能快捷按钮(元素、处理程序){
this.element=元素;
this.handler=handler;
元素。addEventListener('touchstart',this,false);
};
FastButton.prototype.handleEvent=功能(事件){
开关(事件类型){
案例“touchstart”:this.onTouchStart(事件);break;
案例“touchmove”:this.onTouchMove(事件);break;
案例“touchend”:this.onClick(事件);break;
案例“单击”:this.onClick(事件);break;
}
};
FastButton.prototype.onTouchStart=函数(事件){
event.stopPropagation();
this.element.addEventListener('touchend',this,false);
document.body.addEventListener('touchmove',this,false);
this.startX=event.touchs[0].clientX;
this.startY=event.touchs[0].clientY;
isMoving=假;
};
FastButton.prototype.onTouchMove=函数(事件){
if(Math.abs(event.touchs[0].clientX-this.startX)>10 | | Math.abs(event.touchs[0].clientY-this.startY)>10){
这是reset();
}
};
FastButton.prototype.onClick=函数(事件){
这是reset();
this.handler(事件);
如果(event.type=='touchend'){
防止重影单击(this.startX,this.startY);
}
};
FastButton.prototype.reset=函数(){
this.element.removeEventListener('touchend',this,false);
document.body.removeEventListener('touchmove',this,false);
};
函数防止重影单击(x,y){
坐标推(x,y);
设置超时(gpop,2500);
};
函数gpop(){
坐标。拼接(0,2);
};
函数单击(事件){
对于(变量i=0;i
实际的Android仿真器根本不响应任何输入。我甚至无法打开Android浏览器来测试我的应用程序。因此,问题与我使用的工具箱/库无关。这是Android模拟器本身的问题。你能给我看看你的avd(Android虚拟设备)的设置吗?我想你也尝试过从头开始重新创建它了吗?而且我真的建议你尝试设置一个x86仿真器映像,arm仿真真的很慢,根据我的经验,它比arm映像更容易出错。您还需要安装HAXM以进一步提高速度并启用GPU加速。最后,我总是给它一些SD卡空间。如果出于某种原因,这些都不适合你,你可能想试试。@PaulHarris这里是我的AVD的设置。请注意,我设置的两个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加速时,我看到了同样的情况。这并不理想,但禁用它应该可以解决问题。
//======================================================== 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();
})