Welcome to the Treehouse Community
Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.
Looking to learn something new?
Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.
Start your free trial
neil booc
140 Pointserror
i am up to section where you have to make a button but for some reason iam having error on turning the emulator on (Error in an XML file: aborting build)
5 Answers
william parrish
13,774 PointsYour TextView and Button dont appear to include a parent / hierachical layout, such as either a relative layout, a linear layout.
All of your commands at the top above the text view, are not being applied to anything ( i think)
Try something like this
<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"
android:paddingBottom="@dimen/activity_vertical_margin"
android:paddingLeft="@dimen/activity_horizontal_margin"
android:paddingRight="@dimen/activity_horizontal_margin"
android:paddingTop="@dimen/activity_vertical_margin" >
<TextView android:id="@+id/textView1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerHorizontal="true"
android:layout_centerVertical="true"
android:textSize="32sp" />
<Button android:id="@+id/button1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerHorizontal="true"
android:layout_centerVertical="true"
android:text="Button" />
</RelativeLayout>
Also do note in
tools:context="com.example.driod.MainActivity$PlaceholderFragment" >
you may have spelled droid incorrectly when you typed it into XML ( there is no might to it, you 100% did, just verify that your package name matches what you typed in. if your package has the spelling error "driod" you would be ok. Its worth refeactoring it to the correct spelling though)
Try the above layout, its the same thing you had, just incased in a relative layout so all of the padding at the top has something to apply to.
william parrish
13,774 PointsYour problem, is exactly what it is telling you.
Errors in your XML file keep it from building the project, and as such you are not going to get it to run on the emulator until you fix the Errors in your XML file.
neil booc
140 Pointsxml document must start and end within the same entity and error parsing the xml ....dont know what they mean
neil booc
140 Pointsxml document must start and end within the same entity and error parsing the xml ....dont know what they mean
william parrish
13,774 Pointscopy and paste your xml file here, and i will help you sort it out.
neil booc
140 Pointsxmlns:tools="http://schemas.android.com/tools" android:layout_width="match_parent" android:layout_height="match_parent" android:paddingBottom="@dimen/activity_vertical_margin" android:paddingLeft="@dimen/activity_horizontal_margin" android:paddingRight="@dimen/activity_horizontal_margin" android:paddingTop="@dimen/activity_vertical_margin" tools:context="com.example.driod.MainActivity$PlaceholderFragment" >
<TextView
android:id="@+id/textView1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerHorizontal="true"
android:layout_centerVertical="true"
android:textSize="32sp" />
<Button
android:id="@+id/button1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerHorizontal="true"
android:layout_centerVertical="true"
android:text="Button" />
this is all of it
william parrish
13,774 PointsI also added the line xmlns:android="http://schemas.android.com/apk/res/android"
neil booc
140 Pointsthanx a lot it works now