Sign in Join
Wiki copytemporary

Custom Drawn Interface/Using the Android SDK, Emulator and Phones: what changed

Revision 1 to 2. Removed lines have a minus sign; added lines have a plus sign.

OldNewLine
11*(Android only)*
22
33Go back to [[Custom Drawn Interface/Android]]
44
55## Using the Android SDK
66
77Downloading and installing the Android SDK is easy. One just needs to following this link: <http://developer.android.com/sdk/index.html>
88
99### How to configure Ant
1010
1111When issuing 'ant debug' to build and Android project one might receive a lot of errors about missing dependencies. In Linux those can be solved by installing packages which have these dependencies, and that will change from distribution to distribution.
1212
1313#### Configuring Ant in Mandriva Linux
1414
1515These errors:
1616
1717``` bash
1818/usr/bin/build-classpath: error: Could not find jaxp_parser_impl Java extension for this JVM
1919/usr/bin/build-classpath: error: Could not find xml-commons-apis Java extension for this JVM
2020```
2121
2222Can be fixed, respectively, with:
2323
2424``` bash
2525urpmi xerces-j2
2626urpmi xml-commons-jaxp
2727```
2828
2929#### Generic Ant errors
3030
3131This error:
3232
3333``` bash
3434/home/felipe/Programas/lazarus-ccr/examples/androidlcl/android/build.xml:46: taskdef class com.android.ant.SetupTask cannot be found
3535```
3636
3737Means that you need to update the Paths in your project files to correctly point to the SDK.
3838
3939### Recognition of devices under Linux
4040
4141Unlike in Windows, where one needs to install a new set of drivers for nearly every phone, in Linux the Android devices are recognized as generic Android devices (regardless of being a phone, a tablet or a notebook) and they are ready to be used without installing additional drivers. One issue, however, that often appears is that devices are not fully recognized automatically and one receives the error message "?????? no permissions". In this case the command adb devices will look like this:
4242
4343``` bash
4444[felipe@localhost ~]$ cd Programas/android-sdk-linux_x86/tools/
4545[felipe@localhost tools]$ ./adb devices
4646List of devices attached
4747???????????? no permissions
4848```
4949
5050To solve this issue one can proceed with the following steps:
5151
5252**Step 1** - First read the tag of the device using lsusb run as root (or sudo):
5353
5454``` bash
5555[root@localhost Programas]# lsusb
5656Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
5757Bus 001 Device 003: ID 04e8:681c Samsung Electronics Co., Ltd
5858Bus 002 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub
5959Bus 003 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
6060Bus 004 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub
6161Bus 005 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub
6262Bus 006 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub
6363Bus 007 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub
6464Bus 008 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub
6565```
6666
6767The tag in this case is **04e8**
6868
6969**Step 2** - Now, still as root, edit the file /etc/udev/rules.d/51-android.rules
7070
7171If the file doesn't exist yet, then create it. Add the following line to the file:
7272
7373 SUBSYSTEM=="usb|usb_device", SYSFS{idVendor}=="04e8", SYMLINK+="android_adb", MODE="0666"
7474
7575Change the ID to correspond to the id of your device.
7676
7777**Step 3** - Restart the linux usb service (udev)
7878
7979In Ubuntu this can be done with: sudo services udev restart
8080
8181In Mandriva udev doesn't appear as a service, so the only way to get things working for me was restarting the computer.
8282
8383After doing this, the device should be fully recognized and "adb devices" as well as "adb logcat" should work.
8484
8585``` bash
8686[felipe@localhost tools]$ ./adb devices
8787* daemon not running. starting it now on port 5037 *
8888* daemon started successfully *
8989List of devices attached
90901000c31696b6 device
9191```
9292
9393## Using the Emulator
9494
9595### Installing the Emulator
9696
9797### Building an emulator image with sdcard support
9898
9999Step 1: Run the application C:\Program Files\android-sdk-windows\tools\android.bat
100100
101101Step 2: Create a new image, by clicking the New button as in the image below.
102102
103-<figure>
104-<img src="Android_new_image.PNG" title="Android_new_image.PNG" />
105-<figcaption>Android_new_image.PNG</figcaption>
106-</figure>
103+![](/wiki-images/c/c6/Android_new_image.PNG)
107104
108105Step 3: Set the name and properties of the image, the size of the SDCard and add hardware support for the sdcard, as seen on the image below.
109106
110-<figure>
111-<img src="Android_new_image_dialog.PNG" title="Android_new_image_dialog.PNG" />
112-<figcaption>Android_new_image_dialog.PNG</figcaption>
113-</figure>
107+![](/wiki-images/8/8a/Android_new_image_dialog.PNG)
114108
115109### Running an emulator image
116110
117111Step 1: Run the application C:\Program Files\android-sdk-windows\tools\android.bat
118112
119113Step 2: Select the image
120114
121115Step 3: Click on the "start" button, as seen below.
122116
123-<figure>
124-<img src="Android_run_image.PNG" title="Android_run_image.PNG" />
125-<figcaption>Android_run_image.PNG</figcaption>
126-</figure>
117+![](/wiki-images/e/e1/Android_run_image.PNG)
127118
128119### Copying files to the emulator
129120
130121You can use a script similar to this one to copy files from your hard-drive to the emulator. Notice that the image must be running and that it must have sdcard support built inside itself.
131122
132123```dos
133124c:
134125cd "Program Files"
135126cd android-sdk-windows
136127cd tools
137128adb push C:\Mypath\Somefile.extension /sdcard
138129pause
139130```
140131
141132### Installing applications in the emulator
142133
143134Android apps should be packaged in the Android .apk file format. For more information about how to create an .apk file that you can install on an emulator/device instance, see Android Asset Packaging Tool (aapt). After packing a file, it can be installed in the emulator by using the following adb call:
144135
145136```dos
146137c:
147138cd "Program Files"
148139cd android-sdk-windows
149140cd tools
150141adb install C:\Mypath\MyApp.apk
151142pause
152143```
153144
154145## Using the phones
155146
156147Installing the drivers and getting a reliable way to transfer executables and debug software with all the different Android phone can be a challenge in itself.
157148
158149### Installing a File Manager
159150
160151Astonishingly, Android phones don't come with a file manager o.O One can however simply download one from the Android Market. I suggest the following instructions:
161152
1621531\. Connect the phone to a WiFi or Mobile network
163154
1641552\. Click in the "Market" icon in one of the Android desktops. It will be necessary to log into a Google Account to access it.
165156
1661573\. Click the search button and type "oi"
167158
1681594\. Locate and install the "OI File Manager" which is Free
169160
170161### Samsung Galaxy S
171162
172163The first thing to do when using Samsung Galaxy S is not believing the Samsung instructions. They will say that one should install Kies, their horribly crappy PC suite which is 130MB large and fails to install because the first thing that it does is failing to connect to a server in Korea to download even more files. Instead of doing this, following these instructions:
173164
1741651\. Go in the phone menu Settings -\> About Phone -\> USB settings. Change from "KIES" to "Mass storage"
175166
1761672\. Download and install 19 MB of Samsung USB drivers from: <http://drivers.softpedia.com/dyn-postdownload.php?p=96692&t=4&i=1>
177168
1781693\. Connect the cable of the phone
179170
1801714\. Drag the top menu of the phone down and mount the sdcard
181172
182173---
183174*From the Free Pascal wiki, page "Custom Drawn Interface/Using the Android SDK, Emulator and Phones", as it stood on 2015-01-05 after a change by Jwdietrich, out of the wiki's dump of 2024-05-26. Copyright stays with the author who wrote it, according to the old wiki's [[Licensing]] page. If you have concerns about this material, [message the admin](/wiki-contact).*
184175Category: Android
185176Category: Custom Drawn

Back to history