Creating AVD. The First Application. Android Project Structure
Creating AVD. The First Application. Android Project Structure
Creating AVD. The First Application. Android Project Structure
To test our applications we will need an Android Virtual Device (AVD). It is an Android smartphone emulator where !clipse can install and launch our applications. "et#s create it. "aunch Eclipse. $o to Windows % Android Virtual Device Manager Choose ta& Android Virtual Devices Clic' New. Choose device and plat(orm target (rom the list. And let#s give it the corresponding name AVD_for_Nexus_One_by_Google. "et#s also speci() the si*e o( D !ard " #$$ and %VGA +creen mode.
,ress O& and close AVD Manager -inall) we can create our first application and see how it wor's. There multiple versions o( wi*ard (or creating a project as $oogle constantl) changes them. "oo' (or the one that suits )ou the &est. The) are sorted &) date the newest first.
Choose the project t)pe 0 Android / Android Application (ro)ect clic' Next The window (or creating a project appears.
Clic' Next
-rom tic's leave onl) !reate Activity 1 immediatel) a(ter the project creation the Activit) will &e created not to create it manuall). !reate (ro)ect in Wor*space. ,roject will &e created and saved in the de(ault wor'space. Clic' Next
2a'e sure here that in field Activity Na,e MainActivity is specified and in field -ayout Na,e enter ,ain. 3avigation T)pe 1 None. Clic' 'inis/. The project has &een created. 4n the le(t our project appeared let#s e5pand the project. 6e will loo' through the most important and (re7uentl) used (olders and files.
src 1 all our written source code will &e situated in this (older gen 1 filed generated &) the environment that the application re7uires. 8ou &etter not touch an)thing here. (I( there is no such (older 1 edit something in the project and clic' ave &utton). Android 0.11 Android li&raries re7uired (or the application
assets and res 1 (olders (or resource files o( di9erent t)pe AndroidManifest.x,l 1 mani(est or configuration file o( the application
6e will use all this later and it will &e clear what it#s needed (or. +elect the project name on the le(t and let#s run it 0 press !23- 4 ## then choose Android Application
clic' O&. The emulator will &e launched I advise not to touch or press an)thing &ecause it#s lagg) and unsta&le thing. +tartup time is appro5imatel) one minute. 6ait until the (ollowing strings appear in !clipse console.
The application is installed on the emulator and is running. :nloc' the emulator screen (i( it is loc'ed) and o&serve our application.
8ou can see the name o( the application and the name o( the Activit). 6e have just created and launched our first application. I( )ou didn#t manage to launch it and there is a message li'e this in !clipse console ;emulator1 <<<= disconnected. Cancelling >ru.startandroid.develop.ur-irst,roject.2ainAct activit) launch>.; 1 close the emulator and tr) again. I( )ou didn#t manage to do it again 1 restart !clipse. I( (ailed again 1 re&oot. I( it doesn#t wor' even now 1 delete the AVD and create a new one. -inall) it should wor' even i( not (rom the first tr). The main thing here 1 a(ter running the application (CT?" @ -11) tr) to ma'e as (ew motions as )ou can on )our computer. I have spotted a clear tendenc) 1 i( )ou switch di9erent windows while emulator is starting it launches with (aults. Aut i( )ou sit and wait (or a minute 1 ever)thing would &e fine. And turn o9 all the other procedures li'e video rendering that load the s)stem. 8ou can read a&out the emulator in more detail here.