Ritu Raj
Ritu Raj

Reputation: 553

Android: FloatingActionButton could not be instantiated

I am trying to use Floating Action Button(FAB) in my application. However, when I am declaring the same I get the error:

android.support.design.widget.FloatingActionButton could not be instantiated.

I have added following commands to my gradle file:

compile 'com.android.support:appcompat-v7:23.1.1'
compile 'com.android.support:design:23.1.1'
compile 'com.android.support:support-v4:23.1.1'

I have also tried with adding following to my style parent:

parent="@style/Theme.AppCompat"

Also tried having my Activity class extend Activity as well as AppCompatActivity.

Am I missing something? Pls. help

Upvotes: 5

Views: 685

Answers (2)

Suhas Bachewar
Suhas Bachewar

Reputation: 1230

Must have :

compileSdkVersion 23

&

 dependencies {
            classpath 'com.android.tools.build:gradle:1.5.0'

        }

Upvotes: 0

IntelliJ Amiya
IntelliJ Amiya

Reputation: 75778

Android build system uses the Android Plugin for Gradle to support building Android applications with the Gradle build toolkit. The plugin runs independent of Android Studio so the plugin and the Gradle build system can be updated independently of Android Studio.

For FloatingActionButton requirement

Please update your classpath

  dependencies {
        classpath 'com.android.tools.build:gradle:1.5.0'

    }

Upvotes: 2

Related Questions