Go Back   Android Forums > Android Development > Application Development
Application Development Dev Lounge for the Coder Folks
Gamers - Check out our new sister sites!
Nintendo Wii U!    |    OUYA - $99 Android System!

test: Reply
 
LinkBack Thread Tools
Old October 28th, 2012, 02:05 PM   #1 (permalink)
New Member
Thread Author (OP)
 
Join Date: Oct 2012
Posts: 4
 
Device(s):
Carrier: Not Provided

Thanks: 0
Thanked 0 Times in 0 Posts
Default 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.

AdamHorton is offline  
Reply With Quote
Sponsors
Old October 28th, 2012, 04:57 PM   #2 (permalink)
ROM Developer
 
cr5315's Avatar
 
Join Date: Jul 2010
Location: Narnia
Posts: 435
 
Device(s): Current: HTC Evo 4G, Asus Nexus 7 Retired: LG Ally
Carrier: Not Provided

Thanks: 103
Thanked 161 Times in 105 Posts
Default

Can you show us what you have in your activity_main.out.xml?
__________________

(That's a link. Just saying.)
cr5315 is offline  
Reply With Quote
Old October 28th, 2012, 05:07 PM   #3 (permalink)
New Member
Thread Author (OP)
 
Join Date: Oct 2012
Posts: 4
 
Device(s):
Carrier: Not Provided

Thanks: 0
Thanked 0 Times in 0 Posts
Default

By default it was a blank file. I tried adding an XML stub to it but the behavior didn't change.
AdamHorton is offline  
Reply With Quote
Old October 28th, 2012, 08:07 PM   #4 (permalink)
Senior Member
 
jonbonazza's Avatar
 
Join Date: Jul 2010
Gender: Male
Posts: 1,925
 
Device(s): Nexus 4, Samsung Galaxy S II, HTC Evo 4G, Amazon Kindle Fire
Carrier: ATT

Thanks: 235
Thanked 462 Times in 285 Posts
Default

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"
__________________
My blog, Inverted Keystrokes, is looking for aspiring developers (not necessarily with Android) to post articles. If you have any development experience and are interested in participating, please PM me. =)
jonbonazza is online now  
Reply With Quote
Old October 28th, 2012, 09:16 PM   #5 (permalink)
New Member
Thread Author (OP)
 
Join Date: Oct 2012
Posts: 4
 
Device(s):
Carrier: Not Provided

Thanks: 0
Thanked 0 Times in 0 Posts
Default

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.
AdamHorton is offline  
Reply With Quote
Old October 29th, 2012, 12:03 AM   #6 (permalink)
ROM Developer
 
cr5315's Avatar
 
Join Date: Jul 2010
Location: Narnia
Posts: 435
 
Device(s): Current: HTC Evo 4G, Asus Nexus 7 Retired: LG Ally
Carrier: Not Provided

Thanks: 103
Thanked 161 Times in 105 Posts
Default

Make sure you have
Code:
<?xml version="1.0" encoding="utf-8"?>
at the very top of the XML, before the <RelativeLayout>
cr5315 is offline  
Reply With Quote
Old October 29th, 2012, 05:58 AM   #7 (permalink)
New Member
Thread Author (OP)
 
Join Date: Oct 2012
Posts: 4
 
Device(s):
Carrier: Not Provided

Thanks: 0
Thanked 0 Times in 0 Posts
Default

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...
AdamHorton is offline  
Reply With Quote
Reply


Go Back   Android Forums > Android Development > Application Development
Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On



All times are GMT -5. The time now is 07:18 PM.
Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2013, vBulletin Solutions, Inc.