Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Android Studio FloatingActionButton error

I installed Android Studio yesterday, and after battling multiple java and other errors, I have come to an error that I cannot seem to fix. I have not added anything or done any code, I have simply just started a new project and I get this error in the Preview over the phone:

Rendering Problems:

The following classes could not be instantiated: - android.support.design.widget.FloatingActionButton 

Followed by a bunch of Exception Details. All help appreciated, I'm getting desperate. Also, please be specific with complicated answers, as I am not very savvy with this as of yet.

If Exception Details are needed:

android.content.res.Resources$NotFoundException: Unable to find resource ID #0x1080029     at android.content.res.Resources.getResourceName(Resources.java:2235)     at android.content.res.Resources.loadDrawableForCookie(Resources.java:2602)     at android.content.res.Resources.loadDrawable(Resources.java:2540)     at android.content.res.Resources.getDrawable(Resources.java:806)     at android.content.Context.getDrawable(Context.java:458)     at android.support.v4.content.ContextCompatApi21.getDrawable(ContextCompatApi21.java:26)     at android.support.v4.content.ContextCompat.getDrawable(ContextCompat.java:321)     at android.support.v7.widget.AppCompatDrawableManager.getDrawable(AppCompatDrawableManager.java:180)     at android.support.v7.widget.TintTypedArray.getDrawableIfKnown(TintTypedArray.java:70)     at android.support.v7.widget.AppCompatImageHelper.loadFromAttributes(AppCompatImageHelper.java:39)     at android.support.v7.widget.AppCompatImageButton.<init>(AppCompatImageButton.java:65)     at android.support.design.widget.VisibilityAwareImageButton.<init>(VisibilityAwareImageButton.java:37)     at android.support.design.widget.FloatingActionButton.<init>(FloatingActionButton.java:109)     at android.support.design.widget.FloatingActionButton.<init>(FloatingActionButton.java:105)     at java.lang.reflect.Constructor.newInstance(Constructor.java:526)     at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:704)     at android.view.LayoutInflater.rInflate_Original(LayoutInflater.java:835)     at android.view.LayoutInflater_Delegate.rInflate(LayoutInflater_Delegate.java:70)     at android.view.LayoutInflater.rInflate(LayoutInflater.java:811)     at android.view.LayoutInflater.rInflateChildren(LayoutInflater.java:798)     at android.view.LayoutInflater.inflate(LayoutInflater.java:515)     at android.view.LayoutInflater.inflate(LayoutInflater.java:394) 
like image 394
oscaro Avatar asked Feb 27 '16 21:02

oscaro


People also ask

Which support library does the FloatingActionButton belong to?

Android Support Library, revision 22.2. 0. FloatingActionButton.

How do I change the shape of the floating action button on Android?

To change the shape of the Floating action button: You can use the shape property of FloatingActionButton() widget class. Implement BeveledRectangleBorder( ) on this property. The output will be a square floating action button, increase the border-radius value to make a circular type shape.

How do I add a floating action button?

Add the floating action button to your layoutThe size of the FAB, using the app:fabSize attribute or the setSize() method. The ripple color of the FAB, using the app:rippleColor attribute or the setRippleColor() method. The FAB icon, using the android:src attribute or the setImageDrawable() method.

What is extended floating action button?

A floating action button (FAB) performs the primary, or most common, action on a screen. It appears in front of all screen content, typically as a circular shape with an icon in its center. Extended Floating Action Button is the newly introduced class with Material Components library in Android.


2 Answers

I also got this problem today,

Check your build.gradle file, do you use support design lib version 23.2, like

compile 'com.android.support:design:23.2.0' 

if so, change it to version 23.1.0

compile 'com.android.support:design:23.1.0' 

then rebuild your project... seems version 23.2 is still buggy

like image 191
Handrata Samsul Avatar answered Oct 04 '22 01:10

Handrata Samsul


In addition to the change detailed in @Handrata Samsul's answer, I also had to make another change in the build.gradle file.

Modify:

compile 'com.android.support:appcompat-v7:23.2.0' 

to become:

compile 'com.android.support:appcompat-v7:23.1.0' 

Therefore, the sum of all changes were as follows:

compile 'com.android.support:appcompat-v7:23.1.0' compile 'com.android.support:design:23.1.0' 

Thanks.

like image 27
Connor Goddard Avatar answered Oct 04 '22 01:10

Connor Goddard