4

I'm breaking into GUI programming with android, trying to compile and analyze Lunar Lander sample program. The instructions for using Eclipse say to select "Create project from existing source" but that option doesn't exist. If I select File->New->Project I can select "Java project from Existing Ant Buildfile". Using that I've tried selecting various xml files as "Ant Buildfile" but all give me the "The file selected is not a valid Ant buildfile" error.

I just want to run GUI sample projects, preferably with Eclipse. Any useful tips will be appreciated.

4 Answers 4

7

First of all you need to install Eclipse ADT plugin, here are the instructions http://developer.android.com/guide/developing/eclipse-adt.html.

Then you can import sample code in two ways:

  1. File -> New -> Android Project, and choose "Create project from existing source"
  2. If it is already an Eclipse project, click File -> Import, after that right click on the Project and choose Make it an Android Project
0
5

I read you prefer Eclipse, but you can always work from command line.

In a GNU/Linux system it's possible to do

$ cp -r $ANDROID_SDK/samples/android-15/LunarLander .
$ android update project --path LunarLander/ --target 3 --subprojects
$ cd LunarLander/
$ ant debug install

You have to choose the target according to your system. It's possible to pick one id from the list you get with this command

$ android list targets 
0

It should be File->New-> Android Project you need to select. Apparently, you didn't install Android SDK

0

In the past you can use "ant" to compile:

https://tthtlc.wordpress.com/2015/08/01/how-to-quickly-compile-all-the-android-samples-via-command-line/

But since June 2014, the SDK has been encouraging user to migrate to using gradle, but it is frauds with lots of problem. By June 2015, compilation has been mostly successful. Here are the steps:

https://tthtlc.wordpress.com/2015/10/30/how-to-build-android-sdk-samples-using-gradle/

And the full compilation of all the samples under the "android-22" branch: I have 84 successful and 19 failures.

The full logs is available here:

http://pastebin.com/33JBDAqj

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.