31

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)
Floern
  • 33,559
  • 24
  • 104
  • 119
oscaro
  • 435
  • 1
  • 6
  • 12
  • probably a matter of inconsistency in the versions of sdk and design lib. post your gradle file – njzk2 Feb 27 '16 at 22:01

7 Answers7

59

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

Chewpers
  • 2,430
  • 5
  • 23
  • 30
Handrata Samsul
  • 786
  • 5
  • 10
  • 2
    Doing this got rid of my error, but gave me a bunch of new ones EDIT: Changing that one and the one above it made it work, sorry for my previous comment, thank you for the help :) – oscaro Feb 28 '16 at 11:30
  • 2
    This worked for me. It's inexcusable that a fresh installation of the SDK and Android Tools has this sort of error. Thanks! – John Stock Feb 28 '16 at 16:41
  • 1
    huh thanks, at last this solved my problem tried lots of things – Aayushi Feb 29 '16 at 18:17
  • worked for me, too. i tried to solve the same problem whole day, but i couldn't. and then i saw that comment and it worked. – cimenmus Mar 02 '16 at 18:26
  • Lol omg i spent soo much time on google trying to find a solution wondering what I was doing wrong and it turns out it wasn't even my fault. Thanks man! :) – user3718908x100 Mar 07 '16 at 00:24
  • God bless the internet – Alaa M. Nov 08 '16 at 20:48
16

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.

Connor Goddard
  • 635
  • 7
  • 14
4

This worked for me:

I changed in the build.gradle file.

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

to

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

Then clean, rebuild, then "refresh" each layout file. The refresh button on the top right in the layout editor.

Satan Pandeya
  • 3,747
  • 4
  • 27
  • 53
Kev
  • 91
  • 1
  • 6
  • That also worked for me on Android Studio 1.5.1. on Ubuntu. The exact steps were: 1) change compile 'com.android.support:design:23.2.0' To compile 'com.android.support:design:23.1.0' on app/build.gradle dependencies 2) rebuild project 3) refresh view – Angel Mar 02 '16 at 07:18
1

android.content.res.Resources$NotFoundException: Unable to find resource ID #0x1080029

This exception is thrown by the resource APIs when a requested resource can not be found.

You should use stable version .You can then start using the Design library with a single new dependency with :

Do

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

Then Clean-Rebuild-Sync Your IDE .Hope this helps .

Don't

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

Version 23.2.0 is buggy .Its not stable . You should go for stable above version 23.1.0 .

IntelliJ Amiya
  • 74,896
  • 15
  • 165
  • 198
1

The configuration compile is obsolete and has been replaced with implementation and api.

You should use:

implementation 'com.android.support:design:23.0.0'

or:

implementation 'com.android.support:design:28.0.0'

as per your compileSDK version instead of:

compile 'com.android.support:design:23.0.0'
Ameen
  • 1,747
  • 3
  • 16
  • 31
Kukki
  • 11
  • 2
0

That error pops up if any of the following things happen :

  1. You don't have the latest SDK versions installed. Make sure you have the right versions. You need to have Android M installed to use the floating action button. (Use the Android SDK Installer)

  2. Your gradle dependencies are wrong.

If you are new to Android Studios, chances are the problem is both 1 and 2.

For the 2nd issue, go to your gradle file and put this in :

dependencies {
    compile 'com.android.support:design:23.0.0'
}

That should fix the issue.

Henry98
  • 571
  • 2
  • 12
0

also update gradle version you're using for compiling, e.g. 2.13 instead of 2.9/2.10 which fails with higher support libs usually

easiest is to to a gradle task in your main build.gradle:

task wrapper(type: Wrapper) {
  gradleVersion = '2.13'
}

and then run it with

gradle wrapper
Jan Rabe
  • 398
  • 2
  • 12