You have downloaded and configured the Android SDK and Eclipse and
now ready to explore the sample projects provided by Android. But
have you tried importing them into Eclipse?
If yes, then you would have faced an issue which Eclipse reports by
saying that it could not find any projects when you specify the
project directory for import.
Eclipse is right in flashing this error as Android apps are not
eclipse projects. They are Android projects and Eclipse needs help in
identifying their internal structure.
So, here are the correct steps to import the sample Android apps in
Eclipse as a project:
- Set Up SDK Location:
If you have followed the steps to install and set up Eclipse for Android development, you would have already performed this step.
Just make sure that the SDK location is specified in
Eclipse->Window->Preferences->Android
-
Create a NEW Project:
Go to
File->New->Project
-
Select Android Project:
A new dialog box opens up, Select 'Android Project' here. Click Next.
-
Select Sample Android App.:
Select the version of Android that you want to target from the 'Build Target' options. I have selected 'Android 3.2'.
Choose the option 'Create Project From Existing Sample'. Now, the drop down box against this option will populate according to the 'Build target' that you selected. It will list all the available sample apps projects that you have downloaded.
Please note that if there are no sample Apps available in your system for the 'Build target' that you have selected, this drop down box will remain disabled. You should download the sample apps before you can proceed further for your target build.
Click Finish and your your Android sample app will be added as a project in Eclipse. Here is a screen shot of what it might look like:
That's it. You are ready to play with sample Android apps. All the best.