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

Nicholas Kotsiantos
Nicholas Kotsiantos
8,827 Points

Android Studio will not import for me

In the "Making a Button Do Something" video under "how to build a simple android app", Android Studio will automatically complete the import statements for Button and Textview etc. How can I fix this?

3 Answers

Hello,

You can accomplish this by File, Settings, Editor, Auto Import, and check the box labeled "Add unambigous imports on the fly". More on this can be found at this stackoverflow post. Please let us know if this helps or if you need more assistance.

Nicholas Kotsiantos
Nicholas Kotsiantos
8,827 Points

I have the newest version of Android Studio and there no longer is File -> Settings . Instead it is File -> Other Settings -> Default Settings. Then from there I go to Editor -> Code Style -> Java -> Imports, but I do not see a box to "Add unambiguous imports on the fly"

Weird, I have 1.2.1.1 on Linux and can follow those instructions, will check my Windows box when I have a chance. What OS are you using? I also see that the shortcut is Ctrl + Alt + S.

Nicholas Kotsiantos
Nicholas Kotsiantos
8,827 Points

Yosemite 10.10.3 I can just hover over the code and click alt + enter and that works, but it would be nice if it just picked up on it by itself

In that case, it looks like your preference screen is located at Android Studio, Preferences.