After taking a look at the new methods in Material Design, I tried to implement a Floating Action Button in an app. However, I am getting this error in my preview (Previewing Android version 21):
The following classes could not be instantiated:
- android.support.design.widget.FloatingActionButton
(First paragraph of error)
java.lang.NullPointerException
at android.support.v4.graphics.drawable.DrawableCompatLollipop.setTintList(DrawableCompatLollipop.java:56)
at android.support.v4.graphics.drawable.DrawableCompat$LollipopDrawableImpl.setTintList(DrawableCompat.java:145)
at android.support.v4.graphics.drawable.DrawableCompat.setTintList(DrawableCompat.java:270)
etc...
Anyone have any idea? This is my build.gradle:
android {
compileSdkVersion 22
buildToolsVersion "22.0.1"
classpath 'com.android.tools.build:gradle:1.2.3'
defaultConfig {
applicationId "owensetiawan.tutorials.fab"
minSdkVersion 15
targetSdkVersion 22
versionCode 1
versionName "1.0"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
compile 'com.android.support:appcompat-v7:22.2.0'
compile 'com.android.support:design:22.2.0'
}
It would be absolutely fantastic if someone could help me shed some light on my problem.