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 Weather App (2015) Hooking Up the Model to the View Plugging in the Data

Gábor Tóth
Gábor Tóth
11,958 Points

The same exceptions in both projects

Hi, I'm following along the Android Development Course, and when I tried to run the Interactive Story and the Stormy app, I got the same Exceptions and error messages: java.lang.RuntimeException: Unable to start activity ... Caused by: android.view.InflateException: Binary XML file line #16: Failed to resolve attribute at index 6: TypedValue{t=0x1d/d=0xff3f51b5 a=2 r=0x7f0b0013} ... Caused by: java.lang.UnsupportedOperationException: Failed to resolve attribute at index 6: TypedValue{t=0x1d/d=0xff3f51b5 a=2 r=0x7f0b0013}

What could cause these errors? Could someone help me please?

Gábor Tóth
Gábor Tóth
11,958 Points

Hi Steve! Sorry for my late response, thank you for your answer, you were really helpful. Meanwhile, I fixed the problem and it was really simple. In the onCreate method, the setContentView method took the activity_main as a parameter, but it should take content_main. I've fixed it, and now the app is working.

I've read that in the newer versions of Android Studio, you have these two xml files and that you have to put all your new views and styling into the content_main file. But then why doesn't Android Studio know that? It is pretty strange for me. But anyway, thank you

Glad you got it fixed! :+1: It does seem odd that AS doesn't point you in the right direction for that issue.

1 Answer

Hi Gabor,

Can you upload your project into Github? I can then replicate the error and see where the problem lies.

Unsupported Operation Exceptions are often thrown when you try to modify something that's immutable, such as a collection or, more likely in this case, a View.

Does the application crash immediately or run for a moment first? Inserting breakpoints to pin down precisely what's causing the issue may help. I suspect it'll throw this exception as soon as the Activity starts - have you added any graphics files or drawables?

Also, if you can copy the whole of the stack trace, that may help too - copy the whole error into a post.