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

Android Build a Simple Android App (2014) Getting Started with Android Running the Fun Facts Project

Orla McGreal
Orla McGreal
1,625 Points

The emulator won't show the "Hello world" app. There are two errors that I can't fix. Can you please help me?

The error messages are as follows:

1) Error:(8) Error parsing XML: not well-formed (invalid token)

2)Error:Execution failed for task ':app:processDebugResources'.

com.android.ide.common.process.ProcessException: org.gradle.process.internal.ExecException: Process 'command 'C:\Users\OrlaMcGreal\AppData\Local\Android\sdk\build-tools\22.0.1\aapt.exe'' finished with non-zero exit value 1

The code where these errors relate to is here:

android:paddingBottom="@dimen/activity_vertical_margin" tools:context=".FunFactsActivity"

<TextView android:text="@string/hello_world" android:layout_width="wrap_content"
    android:layout_height="wrap_content"/>

<RelativeLayout>

How do I fix these errors?

Thanks in advance!

5 Answers

Ryan Ruscett
Ryan Ruscett
23,309 Points

The first thing I notice is that you don't have any header at the top. So all the text looks dark.

I don't know if you are using android.support.v7 or v4 but you need some osrt of header at the top like in my example below. This should be automatically created for you when you create a new layout. Is this not happening? If you are using version 4. You can simply copy the header I show in the example below. Notice how all my code in my example is active. That is what yours needs to look like.

<android.support.v4.view.ViewPager 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:paddingLeft="@dimen/activity_horizontal_margin" 
    android:paddingRight="@dimen/activity_horizontal_margin" 
    android:paddingTop="@dimen/activity_vertical_margin" 
    android:paddingBottom="@dimen/activity_vertical_margin" 
    tools:context=".FunFactsActivity" 

<TextView android:text="@string/hello_world" 
    android:layout_width="wrap_content" 
    android:layout_height="wrap_content"/>
Jon Kussmann
PLUS
Jon Kussmann
Courses Plus Student 7,254 Points

Hi Orla,

To me that looks like a partial xml file. Would you mind posting the entire thing?

Ryan Ruscett
Ryan Ruscett
23,309 Points

Gradle exception meaning in a The manifest.xml most likely. Which aligns with the malformed xml. Without the file like Jon Kussmann said. Its hard to know the exact problem without seeing the code. But look at the manifest.xml

Orla McGreal
Orla McGreal
1,625 Points

Hey guys, Here it is:

<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:paddingLeft="@dimen/activity_horizontal_margin" android:paddingRight="@dimen/activity_horizontal_margin" android:paddingTop="@dimen/activity_vertical_margin" android:paddingBottom="@dimen/activity_vertical_margin" tools:context=".FunFactsActivity"

<TextView android:text="@string/hello_world" android:layout_width="wrap_content"
    android:layout_height="wrap_content"/>

<RelativeLayout>

Thanks !!

Orla McGreal
Orla McGreal
1,625 Points

Hi Ryan,

Thanks for all your help! I tried your suggestions but no go! So I just created a new project and it works =D! Weird because I didn't do anything different!