Putting files onto the emulator
There are two: using adb (see below) and through file explorer (in ADT
Oh, and one file at a time only
Maybe on real phones, there’s supposed to be an Intent to process your music files when they are copied over to the device. The emulator doesn’t do this, so any music you threw in using the file explorer won’t show up in your “Music” or “Media” application (depends on the version).
You have to start developer tools > Media scanner
to scan for music files
Controlling the emulator
There’s more to the emulator than what your can control with ADT. ADT is quite nice to use, but it only let you:
- Simulate incoming SMS and call
- Simulate geolocation
- View / terminate processes
- Manage files
Actually you can use several tools that come with the SDK and talk to the emulator itself to get more out of it. To connect to the emulator, telnet to local host with the port as the emulator’s number (5554, 5556 and so on). These numbers can be used as phone numbers so the emulators can call / SMS each other, but not receive calls from a connected phone.
The list of commands can be found here
There’s a tool called ADB
Setting the battery to full
(android debug bridge) that can install packages
and put files
on to the sdcard. ADB is used internally by ADT itself, but you can use it to manually control the emulator, doing things like setting the telnet listening port, view system log (logcat) or issuing shell commands
on the device (alternatively you can do this with Dev tools inside the phone)
Solving errors that appear to came out of nowhere
In addition to usual Java errors like forgetting to add imports, put some files in the wrong folder… Sometimes when you import a project from somewhere (like… from Google’s examples :p), the project turns all red (indicating error), you checked the import, they are there, you checked the classes, they are there, you cleaned the project and rebuild as a routine habit when things go wrong with Android, the errors are still there!
Check your project’s properties (default.properties) to see if the target is right. For example, if you are using 2.2
platform, it should be target=android-8
for 2.1 it should be android-7 and so on… assumed you installed the platform with the AVD manager.
Also, when you change API level requirement in AndroidManifest.xml, the project doesn’t seem to build right and it just can’t run, saying something like “Android
requires .class compatibility set to 5.0. Please fix project properties”
You know you need to use this