Debug your project
This is usedEclipseInAndroidPlug-inEclipseThe debugger in also has excellent compatibility. To demonstrate this, let's createBugInCode, Change yourHelloandroidSource codeAs follows:
Public class helloandroid extends activity {
/** Called when the activity is first created .*/
@ Override
Public void oncreate (bundle icicle ){
Super. oncreate (icicle );
Object o = NULL;
O. tostring ();
Setcontentview (R. layout. Main );
}
}
This simple change will causeNullpointerexceptionException. If you run it againProgram, You will see the following screen:
To find out where an error occurs, you need to set a breakpoint in your source code"Object o = NULL ;"After line(You can double-clickEclipseThe Left area of the number of rows),Then selectRun-> debugSelect the last running load. Your program will restart the simulator, but it will be suspended at this time. When it goes to the breakpoint you just setEclipseIn the debug mode view of, it will stop in your code. Just as you can do this in any other program..
Use other ide tools to create a project
If you do not useEclipse (For example, if you use anotherIDEDevelopment tools, or simply use text editing and command line tools)So this plug-in won't help you, don't worry, you won't be using itEclipseWithout any development capability.
ActuallyAndroidOfEclipseThe plug-in also integrates a setAndroid SDKDevelopment tools are packaged.(These tools are like simulators,Aapt, ADB, ddms,For more information, seeGoogleRelated Documentation)Therefore, it can also be packaged by other tools, suchAnt.
InAndroid SDKContainsPythonScript, called"Activitycreator. py"It is used to create all the source code and directory compilation environments for your project.(Personal Understanding),That isAntCompiledBuild. xml.In this way, your project can be created or integrated toIDE.
For example, to createHelloandroidProject, just as we usedEclipseYou can use the following command:
Activitycreator. py -- out helloandroid com. Google. Android. Hello. helloandroid
To compile your project, you need to useAntCommand, when the command line prompts a success, you will seeHelloandroid.apkFile in"Bin"Directory. This. APKFile isAndroid, It needs to use"ADB"Install the tool in the simulator.
So far, I have shown youAndroidA simple development example of the platform program. I have a limited level, and the translation time is too short. There must be many errors and omissions. Please submit more comments for modification. The main content of this series of tutorials is translated fromGoogleOfAndroidDevelopment document. View All content through the link below.
Http://code.google.com/android/intro/hello-android.html