Eclipse development environment imports the source code in the sample of Android SDK

For beginners of Android programming, the sample code provided in the Android SDK is naturally the best learning material.

The sample code is in the SDK installation directory (X: \ Android \ Android SDK \ samples). But I had some trouble importing with the eclipse development environment. I saw someone solve it through "file - > Import..." or "file - > New - > Project - > create project from existing code", but I tried and had some problems. The latter method can be imported successfully, but the project is not copied to the working directory of eclipse (X: \ eclipse \ workspace). After modification as an exercise, the original sample code will be affected and the reference may be lost. In addition, the sample directory attribute of the original SDK will be changed from read-only to writable.

After some tossing, I found that eclipse has provided a very convenient import method. That is "file - > New - > Project - > Android simple project". The following is a screenshot of the operation, which is easy to see.

----------------------------

---------------------

Select the sample version you need.

Select the type of sample you need to study. Apidemos is the most basic and is very suitable for beginners. Press "finish" to finish.

If it has been installed, you don't have to worry about misoperation.

When compiling and running, note that the simulator already contains the apidemos application, which leads to the following error message. In the SDK installation directory (X: \ Android \ Android SDK \ platform tools), execute the command "ADB uninstall com. Example. Android. APIs" in the prompt to uninstall the original apidemos application first.

Then our modifications are successfully displayed in the newly compiled application, such as adding our own ID to the timer.

The content of this article comes from the network collection of netizens. It is used as a learning reference. The copyright belongs to the original author.
THE END
分享
二维码
< <上一篇
下一篇>>