Sign in Join
Wiki copytemporary

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

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

OldNewLine
1-*(Android only)*
1+[![Android robot.svg](https://upload.wikimedia.org/wikipedia/commons/thumb/d/d7/Android_robot.svg/50px-Android_robot.svg.png)](</File:Android_robot.svg>)
22
3+This article applies to [Android](</Category:Android> "Category:Android") only.
4+
5+See also: [[Multiplatform Programming Guide]]
6+
7+│ **English (en)** │ **[[Custom Drawn Interface/Using the Android SDK, Emulator and Phones/ru|русский (ru)]]** │
8+****
9+
310Go back to [[Custom Drawn Interface/Android]]
411
12+## Contents
13+
14+ * 1 Using the Android SDK
15+ * 1.1 How to configure Ant
16+ * 1.1.1 Configuring Ant in Mandriva Linux
17+ * 1.1.2 Generic Ant errors
18+ * 1.2 Recognition of devices under Linux
19+ * 2 Using the Emulator
20+ * 2.1 Installing the Emulator
21+ * 2.2 Building an emulator image with sdcard support
22+ * 2.3 Running an emulator image
23+ * 2.4 Copying files to the emulator
24+ * 2.5 Installing applications in the emulator
25+ * 3 Using the phones
26+ * 3.1 Installing a File Manager
27+ * 3.2 Samsung Galaxy S
28+
529## Using the Android SDK
630
731Downloading and installing the Android SDK is easy. One just needs to following this link: <http://developer.android.com/sdk/index.html>
832
933### How to configure Ant
1034
11-When 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.
35+When 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.
1236
1337#### Configuring Ant in Mandriva Linux
1438
15-These errors:
16-
17-``` bash
39+These errors:
40+```
1841/usr/bin/build-classpath: error: Could not find jaxp_parser_impl Java extension for this JVM
19-/usr/bin/build-classpath: error: Could not find xml-commons-apis Java extension for this JVM
42+ /usr/bin/build-classpath: error: Could not find xml-commons-apis Java extension for this JVM
2043```
2144
22-Can be fixed, respectively, with:
23-
24-``` bash
45+Can be fixed, respectively, with:
46+```
2547urpmi xerces-j2
26-urpmi xml-commons-jaxp
48+ urpmi xml-commons-jaxp
2749```
2850
2951#### Generic Ant errors
3052
31-This error:
32-
33-``` bash
53+This error:
54+```
3455/home/felipe/Programas/lazarus-ccr/examples/androidlcl/android/build.xml:46: taskdef class com.android.ant.SetupTask cannot be found
3556```
3657
37-Means that you need to update the Paths in your project files to correctly point to the SDK.
58+Means that you need to update the Paths in your project files to correctly point to the SDK.
3859
3960### Recognition of devices under Linux
4061
41-Unlike 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:
42-
43-``` bash
62+Unlike 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:
63+```
4464[felipe@localhost ~]$ cd Programas/android-sdk-linux_x86/tools/
45-[felipe@localhost tools]$ ./adb devices
46-List of devices attached
47-???????????? no permissions
65+ [felipe@localhost tools]$ ./adb devices
66+ List of devices attached
67+ ???????????? no permissions
4868```
4969
50-To solve this issue one can proceed with the following steps:
51-
52-**Step 1** - First read the tag of the device using lsusb run as root (or sudo):
70+To solve this issue one can proceed with the following steps:
5371
54-``` bash
72+**Step 1** \- First read the tag of the device using lsusb run as root (or sudo):
73+```
5574[root@localhost Programas]# lsusb
56-Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
57-Bus 001 Device 003: ID 04e8:681c Samsung Electronics Co., Ltd
58-Bus 002 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub
59-Bus 003 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
60-Bus 004 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub
61-Bus 005 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub
62-Bus 006 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub
63-Bus 007 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub
64-Bus 008 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub
75+ Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
76+ Bus 001 Device 003: ID 04e8:681c Samsung Electronics Co., Ltd
77+ Bus 002 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub
78+ Bus 003 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
79+ Bus 004 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub
80+ Bus 005 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub
81+ Bus 006 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub
82+ Bus 007 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub
83+ Bus 008 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub
6584```
6685
6786The tag in this case is **04e8**
6887
69-**Step 2** - Now, still as root, edit the file /etc/udev/rules.d/51-android.rules
70-
71-If the file doesn't exist yet, then create it. Add the following line to the file:
72-
73- SUBSYSTEM=="usb|usb_device", SYSFS{idVendor}=="04e8", SYMLINK+="android_adb", MODE="0666"
88+**Step 2** \- Now, still as root, edit the file /etc/udev/rules.d/51-android.rules
7489
75-Change the ID to correspond to the id of your device.
90+If the file doesn't exist yet, then create it. Add the following line to the file:
91+```
92+SUBSYSTEM=="usb|usb_device", SYSFS{idVendor}=="04e8", SYMLINK+="android_adb", MODE="0666"
93+```
7694
77-**Step 3** - Restart the linux usb service (udev)
95+Change the ID to correspond to the id of your device.
7896
79-In Ubuntu this can be done with: sudo services udev restart
97+**Step 3** \- Restart the linux usb service (udev)
8098
81-In Mandriva udev doesn't appear as a service, so the only way to get things working for me was restarting the computer.
99+In Ubuntu this can be done with: sudo services udev restart
82100
83-After doing this, the device should be fully recognized and "adb devices" as well as "adb logcat" should work.
101+In Mandriva udev doesn't appear as a service, so the only way to get things working for me was restarting the computer.
84102
85-``` bash
103+After doing this, the device should be fully recognized and "adb devices" as well as "adb logcat" should work.
104+```
86105[felipe@localhost tools]$ ./adb devices
87-* daemon not running. starting it now on port 5037 *
88-* daemon started successfully *
89-List of devices attached
90-1000c31696b6 device
106+ * daemon not running. starting it now on port 5037 *
107+ * daemon started successfully *
108+ List of devices attached
109+ 1000c31696b6 device
91110```
92111
93112## Using the Emulator
94113
95114### Installing the Emulator
96115
97116### Building an emulator image with sdcard support
98117
99-Step 1: Run the application C:\Program Files\android-sdk-windows\tools\android.bat
118+Step 1: Run the application C:\Program Files\android-sdk-windows\tools\android.bat
100119
101-Step 2: Create a new image, by clicking the New button as in the image below.
120+Step 2: Create a new image, by clicking the New button as in the image below.
102121
103-![](/wiki-images/c/c6/Android_new_image.PNG)
122+[![Android new image.PNG](/wiki-images/c/c6/Android_new_image.PNG)](</File:Android_new_image.PNG>)
104123
105-Step 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.
124+Step 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.
106125
107-![](/wiki-images/8/8a/Android_new_image_dialog.PNG)
126+[![Android new image dialog.PNG](/wiki-images/8/8a/Android_new_image_dialog.PNG)](</File:Android_new_image_dialog.PNG>)
108127
109128### Running an emulator image
110129
111-Step 1: Run the application C:\Program Files\android-sdk-windows\tools\android.bat
130+Step 1: Run the application C:\Program Files\android-sdk-windows\tools\android.bat
112131
113-Step 2: Select the image
132+Step 2: Select the image
114133
115-Step 3: Click on the "start" button, as seen below.
134+Step 3: Click on the "start" button, as seen below.
116135
117-![](/wiki-images/e/e1/Android_run_image.PNG)
136+[![Android run image.PNG](/wiki-images/e/e1/Android_run_image.PNG)](</File:Android_run_image.PNG>)
118137
119138### Copying files to the emulator
120139
121-You 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.
122-
123-```dos
140+You 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.
141+```
124142c:
125-cd "Program Files"
126-cd android-sdk-windows
127-cd tools
128-adb push C:\Mypath\Somefile.extension /sdcard
129-pause
143+ cd "Program Files"
144+ cd android-sdk-windows
145+ cd tools
146+ adb push C:\Mypath\Somefile.extension /sdcard
147+ pause
130148```
131149
132150### Installing applications in the emulator
133151
134-Android 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:
135-
136-```dos
152+Android 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:
153+```
137154c:
138-cd "Program Files"
139-cd android-sdk-windows
140-cd tools
141-adb install C:\Mypath\MyApp.apk
142-pause
155+ cd "Program Files"
156+ cd android-sdk-windows
157+ cd tools
158+ adb install C:\Mypath\MyApp.apk
159+ pause
143160```
144161
145162## Using the phones
146163
147-Installing 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.
164+Installing 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.
148165
149166### Installing a File Manager
150167
151-Astonishingly, 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:
168+Astonishingly, 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:
152169
153-1\. Connect the phone to a WiFi or Mobile network
170+1\. Connect the phone to a WiFi or Mobile network
154171
155-2\. Click in the "Market" icon in one of the Android desktops. It will be necessary to log into a Google Account to access it.
172+2\. Click in the "Market" icon in one of the Android desktops. It will be necessary to log into a Google Account to access it.
156173
157-3\. Click the search button and type "oi"
174+3\. Click the search button and type "oi"
158175
159-4\. Locate and install the "OI File Manager" which is Free
176+4\. Locate and install the "OI File Manager" which is Free
160177
161178### Samsung Galaxy S
162179
163-The 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:
180+The 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:
164181
165-1\. Go in the phone menu Settings -\> About Phone -\> USB settings. Change from "KIES" to "Mass storage"
182+1\. Go in the phone menu Settings -> About Phone -> USB settings. Change from "KIES" to "Mass storage"
166183
167-2\. Download and install 19 MB of Samsung USB drivers from: <http://drivers.softpedia.com/dyn-postdownload.php?p=96692&t=4&i=1>
184+2\. Download and install 19 MB of Samsung USB drivers from: [http://drivers.softpedia.com/dyn-postdownload.php?p=96692&t=4&i=1](<http://drivers.softpedia.com/dyn-postdownload.php?p=96692&t=4&i=1>)
168185
169-3\. Connect the cable of the phone
186+3\. Connect the cable of the phone
170187
1711884\. Drag the top menu of the phone down and mount the sdcard
172189
173190---
174-*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).*
175-Category: Android
176-Category: Custom Drawn
191+*From the Free Pascal wiki, page "Custom Drawn Interface/Using the Android SDK, Emulator and Phones", as the Internet Archive kept it on 2023-01-28. 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).*

Back to history