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

No Backwards Compability possible

Greets!

Since I'm struggling to get into Android Studio, I've got kind of a bug: Always I'm trying to build a layout, with AppCompat activated, I'm not able to use the design screen, because it ain't showing any elements like ImageView's or TextView's. It's not even placing the usual "Hello World!" element, neither in the design, nor in the bluescreen view.

I can still work with the programm, if AppCompat isn't used, but I guess my App won't be backwards compatible then, which makes it unusable for any older device right? Does anyone have a solution for this problem? (Reinstalling didn't work the last 1000 times I tried it, just in case you would recommend it)

Thanks for bothering!

1 Answer

Jonathan Grieve
MOD
Jonathan Grieve
Treehouse Moderator 91,252 Points

Hi Elsa

Doing some digging, the first thing I would do is check the SDK level you're using and see if it's compatable with the AppCompat Library.

You may be able to go into your XML and where you see things in red in the XML code it means there's some sort of problem and AS doesn't know what to do with the code.

From this link, it looks like AppCompat is supported in SDK level 14 and above so check that when you're making a new Android Studio project you're selecting at least this SKD level.

"Appcompat, compatibility, and support libraries for Lollipop if minimum SDK = 14"

https://stackoverflow.com/questions/29049908/appcompat-compatibility-and-support-libraries-for-lollipop-if-minimum-sdk-14

Good luck! :)

Thanks Jon! The weird problem is, that Android Studio ain't seeing any problem :D I'm not getting any error message, AS tells me everything is fine, the code looks pretty, no red lines anywhere, no missing plugins. I also thought that it must have to do with the SDK Level, because everything works fine if my App ain't backwards compatible. But after a few hours reading posts of other desperate students, I come along the suggestion to change a line in the XML-Layout File about the Theme. Actually it wasn't working for me, but it was close enough to come across a solution:

So the problem seems to be the layout google is providing. Even if you choose an empty activity, the Layout "AppTheme" is choosen. Also it displays an ActionBar. If this theme is selected, the preview ain't working. It seems to me like the ressource of the theme (or the AB) is already damaged somehow and that's why android studio isn't able to update it in any way. So I fixed it with choosing the default Theme "AppCompat.NoActionBar" - do I always have to keep this if I want my App to be backwards compatible? But why is the "AppTheme" then choosen by default?

Does that make any sense? :) Not to me if I'm honest.

But thank you very much for your fast response!