Welcome to the Treehouse Community

The Treehouse Community is a meeting place for developers, designers, and programmers of all backgrounds and skill levels to get support. Collaborate here on code errors or bugs that you need feedback on, or asking for an extra set of eyes on your latest project. Join thousands of Treehouse students and alumni in the community today. (Note: Only Treehouse students can comment or ask questions, but non-students are welcome to browse our conversations.)

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and a supportive community. Start your free trial today.

Android Build a Simple Android App (retired 2014) Getting Started with Android Initial Layout

The emulator is not working :(

The console shows "[2014-05-11 04:42:58 - CrystalBall] Error in an XML file: aborting build."

1 Answer

Ben Jakuben
STAFF
Ben Jakuben
Treehouse Teacher

The XML files are the layout files. Can you copy the entire contents of your activity_main.xml file and paste it in here? Don't worry about formatting...I'll edit it and make sure it shows. Or take a look at the Markdown Cheatsheet below for tips on posting code.

Thank you so much for your help !!! :)

<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"
    tools:context="com.wenynwang.crystalball.MainActivity$PlaceholderFragment" >

    <TextView
        android:id="@+id/textView1"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_centerInParent="true"
        android:textSize="32sp" />

    <Button
        android:id="@+id/button1"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:layout_below="@+id/textView1"
        android:layout_centerHorizontal="true"
        android:text="Enlighten me!" />

</RelativeLayout>
Ben Jakuben
Ben Jakuben
Treehouse Teacher

Okay! Your code looks good, so it must be something else. Do you get any other error indicators about which file it might be? It could be an error in another XML file, like AndroidManifest.xml or strings.xml, or perhaps even an error in a file name.