EzDevInfo.com

android-emulator interview questions

Top android-emulator frequently asked interview questions

Why is my Android emulator keyboard in Chinese character mode?

I'm debugging my Android application using the AVD (Android Virtual Device). When I try to enter text in a text field, my characters are being interpreted as Chinese in the IME.

I don't know how I got into this mode or how to get out of it (I just want to enter alphabetic keys)?

Here's a screen shot:

http://u.go2.me/3cn


Source: (StackOverflow)

How to get the build/version number of your Android application?

I need to figure out how to get or make a build number for my Android application. I need the build number to display in the UI.

Do I have to do something with AndroidManifest.xml?


Source: (StackOverflow)

Advertisements

How to build an APK file in Eclipse?

When I develop the project using Eclipse, the APK file goes on the emulator. But I want to upload my application to a real device. Is there a tool to build an APK file?

What is the process? Or is it possible to pull the APK file from the emulator?


Source: (StackOverflow)

Failed to allocate memory: 8

From today, when I tried to run an app in NetBeans on a 2.3.3 Android platform, it shows me that:

Failed to allocate memory: 8

This application has requested the Runtime to terminate it in an unusual way. Please contact the application's support team for more information.

and the Emulator doesn't want to start.

This is for the first time when I see it, and google has no asnwers for this, I tried even with 2 versions of NetBeans 6.9.1 and 7.0.1, still the same error.


Source: (StackOverflow)

"The connection to adb is down, and a severe error has occured."

I've spent days trying to launch any Android program. Even "Hello World" gives me the same error:

"The connection to adb is down, and a severe error has occured".

I'm running Eclipse Galileo, Google APIs 2.2 8, on a Windows XP machine.

I've used all the tricks I can find on the web: the command line "adb kill-server", the DDMS "reset ADB", I started the emulator both before and after Eclipse, and searched for ports being used by other programs.

What is going on here? Is there a magic combo of versions of Eclipse, Java, adb, emulator, and whatever else that works?


Source: (StackOverflow)

Android emulator doesn't take keyboard input - SDK tools rev 20

I've upgraded the SDK tools to revision 20 (from 18) and since the upgrade, the emulator doesn't seem to accept input from laptop's keyboard. But only using the emulator's own 'soft' keyboard (that appears when an input field is focused).

I've tried reinstalling the SDK tools (and the whole SDK for that matter), uninstalled and reinstalled Eclipse Android plugins, re-created emulator devices. But none of that seem to help and its driving me mad. Its hopeless to key-in using a laptop's trackpad.

Has anyone encountered this problem?


Source: (StackOverflow)

How to take emulator screenshots using Eclipse?

I need to take screenshots of an android application running on an emulator in Eclipse Galileo.

Is there a built-in feature for this or do I have to download a plugin of some sorts?


Source: (StackOverflow)

Android emulator freezing OSX 10.9 (Mavericks) with HAXM

I just updated to Mavericks 10.9 and now whenever I start up any of my emulators, as soon as the emulator starts up, my entire computer freezes with a spinning progress indicator in the center of the screen (not a beachball, progress indicator similar to what you see when shutting down but the screen hasn't faded to grey).

notice the progress indicator in the bottom center of the screen, the computer is frozen at this point

I've tried;

  • Turning off GPU acceleration
  • Uninstalling and re-installing the latest Intel HAXM
  • Re-creating my AVDs
  • Updated my Android SDK-Tools

The only thing that works is to uninstall Intel HAXM / not use hardware acceleration.

I'm guessing there's a bug with Mavericks and HAXM similar to what motivated the release for 1.0.6 of HAXM for OSX 10.8 ?

The following crash report is indicating a kernel panic generated by HAXM.

Anonymous UUID:       2C84F70F-FE54-51E7-4FBE-6E601ED377AF

Tue Oct  8 21:49:39 2013
Panic(CPU 3): NMIPI for spinlock acquisition timeout, spinlock: 0xffffff802deca4d8, spinlock owner: 0xffffff80409f4cf0, current_thread: 0xffffff80409f4cf0, spinlock_owner_cpu: 0x3
RAX: 0xffffff80409f4cf0, RBX: 0xffffff802ded4c40, RCX: 0xffffff80409f4cf0, RDX: 0x0000000700000000
RSP: 0xffffff8115bb9c30, RBP: 0xffffff8115bb9c70, RSI: 0x0000000792aac9d6, RDI: 0xffffff802deca4d8
R8:  0x0000000000000010, R9:  0x0000000000000269, R10: 0x0000000000000000, R11: 0x0000000000000246
R12: 0x0000000000000000, R13: 0xffffff7faf6b3d92, R14: 0xffffff802deca4d8, R15: 0xffffff802d830040
RFL: 0x0000000000000006, RIP: 0xffffff802d8d0470, CS:  0x0000000000000008, SS:  0x0000000000000010
Backtrace (CPU 3), Frame : Return Address
0xffffff8115bb9aa0 : 0xffffff802d8e21f1 
0xffffff8115bb9ad0 : 0xffffff802d8db75f 
0xffffff8115bb9b20 : 0xffffff802d8f3930 
0xffffff8115bb9c70 : 0xffffff802dbeda5f 
0xffffff8115bb9c90 : 0xffffff802d82f741 
0xffffff8115bb9dc0 : 0xffffff802d830018 
0xffffff8115bb9e30 : 0xffffff7faf6a7f86 
0xffffff8115bb9ed0 : 0xffffff802d8e351e 
0xffffff8115bb9f10 : 0xffffff802d8e2e3e 
0xffffff8115bb9f50 : 0xffffff802d8e21c6 
0xffffff8115bb9f80 : 0xffffff802d8db75f 
0xffffff8115bb9fd0 : 0xffffff802d8f37c9 
0xffffff815a62bd00 : 0xffffff802d9fd8bd 
0xffffff815a62bd80 : 0xffffff802d9f3787 
0xffffff815a62bdc0 : 0xffffff802dbf0eeb 
0xffffff815a62beb0 : 0xffffff802dbf0b88 
0xffffff815a62bf50 : 0xffffff802dc3de23 
0xffffff815a62bfb0 : 0xffffff802d8f3e06 
      Kernel Extensions in backtrace:
         com.intel.kext.intelhaxm(1.0.6)[49CE9C16-9447-31FE-A856-4BDD043A302D]@0xffffff7faf6a6000->0xffffff7faf6c2fff

BSD process name corresponding to current thread: syslogd

Mac OS version:
13A598

Kernel version:
Darwin Kernel Version 13.0.0: Thu Sep 19 22:22:27 PDT 2013; root:xnu-2422.1.72~6/RELEASE_X86_64
Kernel UUID: 1D9369E3-D0A5-31B6-8D16-BFFBBB390393
Kernel slide:     0x000000002d600000
Kernel text base: 0xffffff802d800000
System model name: MacBookPro8,1 (Mac-94245B3640C91C81)

System uptime in nanoseconds: 5867020237
last loaded kext at 5616463499: com.intel.kext.intelhaxm    1.0.6 (addr 0xffffff7faf6a6000, size 118784)
loaded kexts:
com.intel.kext.intelhaxm    1.0.6
com.razerzone.razerapo  1.00.84
com.cyberic.SmoothMouse 7
com.apple.driver.AppleTyMCEDriver   1.0.2d2
com.apple.driver.AGPM   100.14.11
com.apple.iokit.IOBluetoothSerialManager    4.2.0f6
com.apple.driver.AppleMikeyHIDDriver    124
com.apple.driver.AppleHDAHardwareConfigDriver   2.5.2fc2
com.apple.driver.AppleHDA   2.5.2fc2
com.apple.driver.AudioAUUC  1.60
com.apple.iokit.IOUserEthernet  1.0.0d1
com.apple.Dont_Steal_Mac_OS_X   7.0.0
com.apple.driver.AppleHWAccess  1
com.apple.driver.AppleUpstreamUserClient    3.5.13
com.apple.driver.ApplePolicyControl 3.4.12
com.apple.iokit.IOBluetoothUSBDFU   4.2.0f6
com.apple.iokit.BroadcomBluetoothHostControllerUSBTransport 4.2.0f6
com.apple.driver.AppleIntelHD3000Graphics   8.1.8
com.apple.driver.AppleThunderboltIP 1.0.10
com.apple.driver.AppleSMCLMU    2.0.4d1
com.apple.driver.AppleMikeyDriver   2.5.2fc2
com.apple.driver.AppleSMCPDRC   1.0.0
com.apple.driver.ACPI_SMC_PlatformPlugin    1.0.0
com.apple.driver.AppleLPC   1.7.0
com.apple.driver.AppleIntelSNBGraphicsFB    8.1.8
com.apple.driver.AppleMuxControl    3.4.12
com.apple.driver.AppleBacklight 170.3.5
com.apple.driver.AppleMCCSControl   1.1.12
com.apple.driver.SMCMotionSensor    3.0.4d1
com.apple.driver.AppleUSBTCButtons  240.2
com.apple.driver.AppleUSBTCKeyEventDriver   240.2
com.apple.driver.AppleUSBTCKeyboard 240.2
com.apple.driver.AppleIRController  325.7
com.apple.driver.AppleFileSystemDriver  3.0.1
com.apple.AppleFSCompression.AppleFSCompressionTypeDataless 1.0.0d1
com.apple.AppleFSCompression.AppleFSCompressionTypeZlib 1.0.0d1
com.apple.BootCache 35
com.apple.driver.XsanFilter 404
com.apple.driver.AppleSDXC  1.4.0
com.apple.iokit.AppleBCM5701Ethernet    3.6.9b9
com.apple.iokit.IOAHCIBlockStorage  2.4.0
com.apple.driver.AppleUSBHub    650.4.4
com.apple.driver.AppleFWOHCI    4.9.9
com.apple.driver.AirPort.Brcm4331   700.20.22
com.apple.driver.AppleAHCIPort  2.9.5
com.apple.driver.AppleUSBEHCI   650.4.1
com.apple.driver.AppleUSBUHCI   650.4.0
com.apple.driver.AppleSmartBatteryManager   161.0.0
com.apple.driver.AppleACPIButtons   2.0
com.apple.driver.AppleRTC   2.0
com.apple.driver.AppleHPET  1.8
com.apple.driver.AppleSMBIOS    2.0
com.apple.driver.AppleACPIEC    2.0
com.apple.driver.AppleAPIC  1.7
com.apple.driver.AppleIntelCPUPowerManagementClient 216.0.0
com.apple.nke.applicationfirewall   153
com.apple.security.quarantine   3
com.apple.driver.AppleIntelCPUPowerManagement   216.0.0
com.apple.iokit.IOSCSIArchitectureModelFamily   3.6.0
com.apple.AppleGraphicsDeviceControl    3.4.12
com.apple.iokit.IOSerialFamily  10.0.7
com.apple.driver.DspFuncLib 2.5.2fc2
com.apple.vecLib.kext   1.0.0
com.apple.iokit.IOFireWireIP    2.2.5
com.apple.iokit.IOAudioFamily   1.9.4fc11
com.apple.kext.OSvKernDSPLib    1.14
com.apple.iokit.IOSurface   91
com.apple.iokit.IOBluetoothFamily   4.2.0f6
com.apple.driver.AppleHDAController 2.5.2fc2
com.apple.iokit.IOHDAFamily 2.5.2fc2
com.apple.iokit.IOBluetoothHostControllerUSBTransport   4.2.0f6
com.apple.driver.AppleThunderboltEDMSink    1.2.1
com.apple.driver.AppleThunderboltDPOutAdapter   2.5.0
com.apple.driver.AppleSMBusPCI  1.0.12d1
com.apple.driver.IOPlatformPluginLegacy 1.0.0
com.apple.driver.IOPlatformPluginFamily 5.5.1d27
com.apple.driver.AppleGraphicsControl   3.4.12
com.apple.driver.AppleBacklightExpert   1.0.4
com.apple.iokit.IONDRVSupport   2.3.6
com.apple.driver.AppleSMBusController   1.0.11d1
com.apple.iokit.IOGraphicsFamily    2.3.6
com.apple.driver.AppleSMC   3.1.6d1
com.apple.driver.AppleThunderboltDPInAdapter    2.5.0
com.apple.driver.AppleThunderboltDPAdapterFamily    2.5.0
com.apple.driver.AppleThunderboltPCIDownAdapter 1.4.0
com.apple.driver.AppleUSBMultitouch 240.6
com.apple.iokit.IOUSBHIDDriver  650.4.4
com.apple.driver.AppleUSBMergeNub   650.4.0
com.apple.driver.AppleUSBComposite  650.4.0
com.apple.driver.AppleThunderboltNHI    1.9.2
com.apple.iokit.IOThunderboltFamily 2.8.5
com.apple.iokit.IOEthernetAVBController 1.0.3b3
com.apple.driver.mDNSOffloadUserClient  1.0.1b4
com.apple.iokit.IOUSBUserClient 650.4.4
com.apple.iokit.IOFireWireFamily    4.5.5
com.apple.iokit.IO80211Family   600.34
com.apple.iokit.IONetworkingFamily  3.2
com.apple.iokit.IOAHCIFamily    2.6.0
com.apple.iokit.IOUSBFamily 650.4.4
com.apple.driver.AppleEFINVRAM  2.0
com.apple.driver.AppleEFIRuntime    2.0
com.apple.iokit.IOHIDFamily 2.0.0
com.apple.iokit.IOSMBusFamily   1.1
com.apple.security.sandbox  278.10
com.apple.kext.AppleMatch   1.0.0d1
com.apple.security.TMSafetyNet  7
com.apple.driver.AppleKeyStore  2
com.apple.driver.DiskImages 371.1
com.apple.iokit.IOStorageFamily 1.9
com.apple.iokit.IOReportFamily  21
com.apple.driver.AppleFDEKeyStore   28.30
com.apple.driver.AppleACPIPlatform  2.0
com.apple.iokit.IOPCIFamily 2.8
com.apple.iokit.IOACPIFamily    1.4
com.apple.kec.pthread   1
com.apple.kec.corecrypto    1.0
panic(cpu 1 caller 0xffffff802dbeda5f): "Spinlock acquisition timed out: lock=0xffffff802deca4d8, lock owner thread=0xffffff80409f4cf0, current_thread: 0xffffff8040364450, lock owner active on CPU 0x3, current owner: 0xffffff80409f4cf0"@/SourceCache/xnu/xnu-2422.1.72/osfmk/i386/locks_i386.c:365
Backtrace (CPU 1), Frame : Return Address
0xffffff815a5db810 : 0xffffff802d822f69 
0xffffff815a5db890 : 0xffffff802dbeda5f 
0xffffff815a5db8b0 : 0xffffff802d82f741 
0xffffff815a5db9e0 : 0xffffff802d830018 
0xffffff815a5dba50 : 0xffffff7faf6a7f86 
0xffffff815a5dbaf0 : 0xffffff802d8e351e 
0xffffff815a5dbb30 : 0xffffff802d8e3c78 
0xffffff815a5dbb70 : 0xffffff7faf6b01e0 
0xffffff815a5dbba0 : 0xffffff7faf6aa2e0 
0xffffff815a5dbbe0 : 0xffffff7faf6a6e3c 
0xffffff815a5dbc00 : 0xffffff802dc58316 
0xffffff815a5dbc60 : 0xffffff802dc56051 
0xffffff815a5dbcb0 : 0xffffff802dc5497e 
0xffffff815a5dbd10 : 0xffffff802dc5465c 
0xffffff815a5dbd80 : 0xffffff802dc67074 
0xffffff815a5dbe10 : 0xffffff802d85c590 
0xffffff815a5dbe50 : 0xffffff802d826bb1 
0xffffff815a5dbe80 : 0xffffff802d8139b5 
0xffffff815a5dbef0 : 0xffffff802d81e003 
0xffffff815a5dbf70 : 0xffffff802d8c921d 
0xffffff815a5dbfb0 : 0xffffff802d8f3e26 
      Kernel Extensions in backtrace:
         com.intel.kext.intelhaxm(1.0.6)[49CE9C16-9447-31FE-A856-4BDD043A302D]@0xffffff7faf6a6000->0xffffff7faf6c2fff

BSD process name corresponding to current thread: kextd

System Profile:
Model: MacBookPro8,1, BootROM MBP81.0047.B27, 2 processors, Intel Core i5, 2.4 GHz, 8 GB, SMC 1.68f99
Graphics: Intel HD Graphics 3000, Intel HD Graphics 3000, Built-In, 512 MB
Memory Module: BANK 0/DIMM0, 4 GB, DDR3, 1333 MHz, 0x0198, 0x393955353432382D3034302E413031472020
Memory Module: BANK 1/DIMM0, 4 GB, DDR3, 1333 MHz, 0x0198, 0x393955353432382D3034302E413031472020
AirPort: spairport_wireless_card_type_airport_extreme (0x14E4, 0xD6), Broadcom BCM43xx 1.0 (5.106.98.100.22)
Bluetooth: Version 4.2.0f6 12982, 3 services, 15 devices, 1 incoming serial ports
Network Service: Wi-Fi, AirPort, en1
Serial ATA Device: OCZ-VERTEX3, 120.03 GB
Serial ATA Device: TOSHIBA MK5065GSXF, 500.11 GB
USB Device: FaceTime HD Camera (Built-in)
USB Device: Hub
USB Device: Apple Internal Keyboard / Trackpad
USB Device: BRCM2070 Hub
USB Device: Bluetooth USB Host Controller
USB Device: Hub
USB Device: IR Receiver
Thunderbolt Bus: MacBook Pro, Apple Inc., 22.1
Model: MacBookPro8,1, BootROM MBP81.0047.B27, 2 processors, Intel Core i5, 2.4 GHz, 8 GB, SMC 1.68f99
Graphics: Intel HD Graphics 3000, Intel HD Graphics 3000, Built-In, 512 MB
Memory Module: BANK 0/DIMM0, 4 GB, DDR3, 1333 MHz, 0x0198, 0x393955353432382D3034302E413031472020
Memory Module: BANK 1/DIMM0, 4 GB, DDR3, 1333 MHz, 0x0198, 0x393955353432382D3034302E413031472020
AirPort: spairport_wireless_card_type_airport_extreme (0x14E4, 0xD6), Broadcom BCM43xx 1.0 (5.106.98.100.22)
Bluetooth: Version 4.2.0f6 12982, 3 services, 15 devices, 1 incoming serial ports
Network Service: Wi-Fi, AirPort, en1
Serial ATA Device: OCZ-VERTEX3, 120.03 GB
Serial ATA Device: TOSHIBA MK5065GSXF, 500.11 GB
USB Device: FaceTime HD Camera (Built-in)
USB Device: Hub
USB Device: Apple Internal Keyboard / Trackpad
USB Device: BRCM2070 Hub
USB Device: Bluetooth USB Host Controller
USB Device: Hub
USB Device: IR Receiver
Thunderbolt Bus: MacBook Pro, Apple Inc., 22.1

Source: (StackOverflow)

Why is the Android emulator so slow? How can we speed up the Android emulator?

I have a 2.67 GHz Celeron processor, and 1.21 GB of RAM on a x86 Windows XP Professional machine.

My understanding is that the Android Emulator should start fairly quickly on such a machine, but for me it does not. I have followed all the instructions in setting up the IDE, SDKs, JDKs and such and have had some success in starting the emulator quickly, but that is very rare. How can I, if possible, fix this problem?

Even if it starts and loads the home screen, it is very sluggish. I have tried the Eclipse IDE in version 3.5 (Galileo) and 3.4 (Ganymede).


Source: (StackOverflow)

Running the new Intel emulator for Android

Lately Google and Intel have published a new way to run the emulator, which should work much better than the previous version (which has emulated ARM CPU). Here are some links about it: this and this.

However, after installing the new components and creating a new emulator configuration as instructed, I get an error and I also can't see any improvements. I've tried both API 10 and API 15, and with GPU enabled and disabled. None of those configurations helped. I've also tried it on two different computers and didn't get any boost (and got the same errors).

It seems that on the posts I've read about it, nobody had any problems with it and all report a much faster emulator.

The error it shows is:

emulator: Failed to open the HAX device!
HAX is not working and emulator runs in emulation mode
emulator: Open HAX device failed

Why is it happening, and is there a way to fix it? Is there anyone else who gets those errors or vice versa?

By the way, I have an Intel CPU, if that could be a problem.


EDIT:

here's what I see in the BIOS, so it should be available... :

enter image description here


Source: (StackOverflow)

The Android emulator is not starting, showing "invalid command-line parameter"

I made a simple "Hello World" program in Eclipse. I added nothing to a Java file and only added a text view in file main.xml as

//main.xml file
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:orientation="vertical"
    android:layout_width="fill_parent"
    android:layout_height="fill_parent"
    >
    <TextView
        android:layout_width="fill_parent"
        android:layout_height="wrap_content"
        android:text="Hello World"
    />
</LinearLayout>

And now when I run my program it shows the following in the console.

//console output
[2011-07-10 07:10:22 - demo] ------------------------------
[2011-07-10 07:10:22 - demo] Android Launch!
[2011-07-10 07:10:24 - demo] adb is running normally.
[2011-07-10 07:10:24 - demo] Performing com.demo.DemoActivity activity launch
[2011-07-10 07:10:25 - demo] Automatic Target Mode: launching new emulator with compatible AVD 'vishal'
[2011-07-10 07:10:25 - demo] Launching a new emulator with Virtual Device 'vishal'
[2011-07-10 07:11:06 - Emulator] invalid command-line parameter: Files\Android\android-sdk\tools/emulator-arm.exe.
[2011-07-10 07:11:07 - Emulator] Hint: use '@foo' to launch a virtual device named 'foo'.
[2011-07-10 07:11:07 - Emulator] please use -help for more information

//--------------------------------------------------------------------------------/

This shows my Android Virtual Device (AVD) could not start due to some reason. What can I do to fix this problem?


Source: (StackOverflow)

How do I fix "Failed to sync vcpu reg" error?

I'm trying to use the Intel HAX x86 emulator for Windows (8, if that matters). I installed everything and created an AVD for the android version, and everything appears correct, but when I run it, I get this output:

Starting emulator for AVD 'x86_QVGA_Level10'
emulator: device fd:1044
HAX is working and emulator runs in fast virt mode
emulator: Failed to sync vcpu reg
emulator: Failed to sync HAX vcpu context

and the emulator won't run. The significant part of this error (Failed to sync vcpu reg) is not mentioned ANYWHERE online, except in the source code for the HAX itself, but I can't figure out how to make any sense of this.

Can anyone advise about how to get past this error? I really need to get this working, because debugging on device and in the default emulators is painfully slow.


Source: (StackOverflow)

Set ImageView width and height programmatically?

How can I set an ImageView's width and height programmatically?


Source: (StackOverflow)

How to connect to my http://localhost web server from Android Emulator in Eclipse

What can I do in Eclipse's Android emulator to connect it to my localhost web server page at http://localhost or http://127.0.0.1?

I've tried it, but the emulator still takes my request like a Google search for localhost or worse it says that it didn't found the page while my web server is normally running.


Source: (StackOverflow)

How to connect android emulator to the internet

How can I connect my Android emulator to the internet, e.g. to use the browser? I've found lots of advice on what do to when your connected through a proxy, but that's not the case here, my machine (Windows 7) is directly connected to the router.


Source: (StackOverflow)