In creating a new Android 5/Lollipop app that uses the latest Material Design, I created a new project and selected Android 5 (API 21) (NOT API 20+: Android L (Preview)!). In the process of bringing up the application, Android Studio threw exceptions that it couldn’t find Java class android.support.v4.view.View, among others. To solve this problem I had to add a support library (also known as a library dependency) to the project. This is accomplished via File > Project Structure (Ctrl + Alt + Shift + S) to bring up the Project Structure window.
To add a library dependency, select the Dependencies tab at the top right, click on the plus symbol on the far upper right (see big red arrow above) and then click “1 Library dependency.”
This brings up the “Choose Library Dependency” dialog. I’ve stretched it out to show all that are available to me. You selection will be dependent on the all the APIs you’ve chosen to support. I’ve highlighted the v4 support library. Once you’ve selected the dependency library you need click “OK” all the way back. Once that’s done the project will resync itself, and if you’ve found all the dependencies that project says it needs, Gradle will complete successfully.
I realize this is beta code. But this was a new project and all dependencies should have been automatically settled during the creation process. The way Android Studio is behaving right now it’s as if it were still late stage alpha code.
This is also one of the worst UI examples I’ve ever come across, bordering on disastrous. None of this is intuitive, all the way from digging out the main dialog. I know that Google didn’t write the IDE, but they selected it, and they now share responsibility for how bad it is. And this is very bad indeed.