Android: FloatingActionButton could not be created

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

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

I added the 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 also tried adding the following to the parent style:

 parent="@style/Theme.AppCompat" 

Also tried to have an Activity extend Activity class, as well as an AppCompatActivity .

Am I missing something? Pls. help

+5
source share
2 answers

The Android build system uses the Android Plugin for Gradle to support building Android applications using the Gradle build tools. The plugin works independently of Android Studio, so the plugin and Gradle build system can be updated independently of Android Studio.

For FloatingActionButton requirements

Update your classpath

  dependencies { classpath 'com.android.tools.build:gradle:1.5.0' } 
+2
source

Must be:

 compileSdkVersion 23 

&

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

Source: https://habr.com/ru/post/1242155/


All Articles