My Android Studio is unable to find the CoordinatorLayout
class.
Screenshot :
It says:
The following classes could not be found: -android.support.design.widget.CoordinatorLayout.
This is my xml code:
<?xml version="1.0" encoding="utf-8"?>
<android.support.design.widget.CoordinatorLayout
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:paddingBottom="@dimen/activity_vertical_margin"
android:paddingLeft="@dimen/activity_horizontal_margin"
android:paddingRight="@dimen/activity_horizontal_margin"
android:paddingTop="@dimen/activity_vertical_margin"
tools:context="com.musical_box.musicbox.MainActivity">
<FrameLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="@+id/player_Control_container">
</FrameLayout>
</android.support.design.widget.CoordinatorLayout>
I know this question has been asked a lot of times but i have tried most of the solutions, and none worked for me. One thing I noticed that Android Studio is not suggesting CoordinatorLayout
while writing code. I am guessing that there are some missing libraries. Here is the code for my gradle build:
apply plugin: 'com.android.application'
android {
compileSdkVersion 24
buildToolsVersion "24.0.0"
defaultConfig {
applicationId "com.musical_box.musicbox"
minSdkVersion 15
targetSdkVersion 24
versionCode 1
versionName "1.0"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
testCompile 'junit:junit:4.12'
compile 'com.android.support:appcompat-v7:24.0.0'
compile 'com.android.support:support-v4:24.0.0'
}
I have build tools 24.0.0 installed on my system. Can anyone help as I am unable to figure out the problem and new to Android dev.
Any help is much appreciated.
Add
compile 'com.android.support:design:24.1.1'
to your gradle file. It should work. Its part of design library. So you need to add this one to access CoordinatorLayout
.