• After 15+ years, we've made a big change: Android Forums is now Early Bird Club. Learn more here.

Apps Trying to set up my development environment

I'm trying to get a simple Hello World app to build and hopefully get it to show up on my phone. I've been following the tutorials and I've managed to get Eclipse set up with the Android plug-in. I'll outline the steps I'm taking and maybe someone could tell me what I'm doing wrong? I'll be happy to provide more details if needed.

I'm using Windows 7 x64 for this, and my phone is a Samsung Stratosphere in case that matters.

I start up Eclipse and click on the New Android Project button.
I enter in some names and keep the rest of the defaults:
Build SDK is Android 4.1.2 (API 16)
Minimum Required DSK is API 8: Android 2.2 (Froyo)
I keep the BlankActivity selected and make no changes to the defaults there.

I see the default screen where it shows my project name and it says "Hello world!" in the middle.

Now, the tutorials say I should be able to press the press the "Play" button to build the project and this is where I see the error:

In the Console:
"[2012-10-28 15:00:12 - asdfasdf] Error in an XML file: aborting build."

I look in Markers and it says "Android XML Format Problem" and then "Premature end of file." for activity_main.out.xml -- I've tried putting a few things in here but I'm definitely not far enough along to be able to understand what this means or how it fits with everything else. I thought this was supposed to be ready to build and run with just a "Hello world!" screen, since that's how the tutorials want to teach this to me, but it appears not.

How do I get this project to build, and/or is there a more accepted tutorial around here that won't run into this problem? This is my first post so I'm not allowed to put in a link, but the tutorial I'm using is from developer dot android dot com.

Thanks for any help.
 
By default it should not be a blank file. It should be pre-populated with a Hello World TextView. Regardless, if the file is entirely blank, that is your problem. At the very least, you need to have the following:
Code:
<?xml version="1.0" encoding="utf-8"?>

You might also need to have a parent Layout. Any kind of Layout would work--LinearLayout, RelativeLayout, etc... Just make sure the parent layout has the attribute:
Code:
xmlns:android="http://schemas.android.com/apk/res/android"
 
Just to be clear, I really have no idea what I'm doing. Sorry if I sound stupid...

I tried putting something into activity_main.out.xml -- adding a layout, and then I viewed the xml file and it had that attribute in it. Then, I tried to build it and it generated an activity_main.out.out.xml file. I'm not sure exactly where I am here, so I'll start from scratch...

By default there is an activity_main.xml file with the following content:

Code:
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:tools="http://schemas.android.com/tools"
    android:layout_width="match_parent"
    android:layout_height="match_parent" >

    <TextView
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_centerHorizontal="true"
        android:layout_centerVertical="true"
        android:text="@string/hello_world"
        tools:context=".MainActivity" />

</RelativeLayout>

There is no activity_main.out.xml file.

I press the build button

Now there is an activity_main.out.xml file with nothing in it, and I get the same error as before. It seems that whenever something is in one of these files and I try to build, it feels the need to create a new xml file with another ".out" in it and then invent some error for me.

The tutorial said I should be able to build this without modifying it. I'm just trying to get past one of the first steps on this tutorial so I can get some idea of what's going on here. Right now I'm completely lost and fumbling around in the dark.
 
Make sure you have
Code:
<?xml version="1.0" encoding="utf-8"?>
at the very top of the XML, before the <RelativeLayout>
 
I put this at the top of the activity_main.xml file (odd that it wasn't there by default), but I still get the exact same behavior...
 
Back
Top Bottom