4

I'm just now learning how to develop in Android Studio and this error come up when I began my helloworld tutorial:

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

The exception details are:

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

I'm using version 23.2.0 of the Android Support Design library.

How can I get the FloatActionButton to render in the preview pane?

https://i.stack.imgur.com/knyFA.png

Paul Lammertsma
  • 37,593
  • 16
  • 136
  • 187

3 Answers3

4

Look at the error stack trace generated by the previewer. It says it cannot find a drawable resource by id 0x1080029. Does a drawable exist by that ID? Are you supplying an invalid ID? On my system it appears resources start at 0x7f010000.

Also found this: Android Studio FloatingActionButton error. It says there could be a bug in version 23.2.0 of the support design lib and that downgrading to 23.1.0 fixes it.

Community
  • 1
  • 1
drhr
  • 2,261
  • 2
  • 17
  • 35
  • I'm not sure what that ID means or stands for. So how would I change it? –  Mar 02 '16 at 20:59
  • The IDs are integers that are generated by android build tools based on the resources that you have in your project, and also by explicitly declared ids in `ids.xml` or implicitly declared id when you use `android:id="@+id/something"`. The first thing I would do is make sure your `getDrawable` is using a valid drawable resource ID, in the form `R.drawable.some_name`. The second thing would be to get Android Studio to regenerate the generated R files, and recompile the code to make sure `content_main.xml` is referring to the most up-to-date compiled code. – drhr Mar 02 '16 at 21:11
  • Added a comment in my answer - appears others are having the same issue. – drhr Mar 02 '16 at 21:15
  • Thank you! So how would I downgrade to 23.2.0? –  Mar 02 '16 at 22:22
  • 4
    First open your `build.gradle` file. In Android Studio, you can quickly search by opening the search window by tapping `Shift` twice and typing build.gradle. In that file, I'm assuming you have a line like `compile 'com.android.support:design:23.2.0'`. Just change that to 23.1.0, and Android Studio will sync the gradle config file the next time you try to compile (or will prompt you to do it now). – drhr Mar 02 '16 at 22:43
1

Upgrade to Android Support Library version 23.2.1 resolves the issue. It's already available in Android Studio SDK manager.

alldigital
  • 11
  • 1
0

There appears to be a bug in version 23.2.0 of the Android Support libraries; simply downgrading to 23.1.1 and rebuilding your project should make the problem disappear.

Note that the problem is not just in the Design library; also the AppCompat widgets cause problems for AppCompatButton and AppCompatImageButton also give similar errors reporting missing resources.

Paul Lammertsma
  • 37,593
  • 16
  • 136
  • 187