Resources$NotFoundException: Resource ID #0x0
See original GitHub issueHi.
im trying to implement the standard drawer in my app (the one that shows up when you open the sample app), however i am getting a ResourceNotFoundException and i have no idea why.
this is my code:
IProfile profile = new ProfileDrawerItem().withName("Homer Simpson").withEmail("doh!@gmail.com").withIcon("http://www.yourtv.com.au/img/blog/homer-simpson.jpg");
mHeader = new AccountHeaderBuilder()
.withActivity(this)
.withTranslucentStatusBar(true)
// .withHeaderBackground(R.drawable.header)
.addProfiles(profile)
.withSavedInstance(savedInstanceState)
.build();
mDrawer = new DrawerBuilder()
.withActivity(this)
.withHasStableIds(true)
.withAccountHeader(mHeader)
.addDrawerItems(new PrimaryDrawerItem().withName("inbox").withIdentifier(DRAWERITEM_ID_INBOX).withSelectable(false),
new PrimaryDrawerItem().withName("therapists").withIdentifier(DRAWERITEM_ID_THERAPISTS).withSelectable(false),
new PrimaryDrawerItem().withName("my treatments").withIdentifier(DRAWERITEM_ID_MYTREATMENTS).withSelectable(false),
new PrimaryDrawerItem().withName("evaluation").withIdentifier(DRAWERITEM_ID_EVALUATION).withSelectable(false),
new PrimaryDrawerItem().withName("diagnosis").withIdentifier(DRAWERITEM_ID_DIAGNOSIS).withSelectable(false),
new PrimaryDrawerItem().withName("calendar").withIdentifier(DRAWERITEM_ID_CALENDAR).withSelectable(false),
new PrimaryDrawerItem().withName("logout").withIdentifier(DRAWERITEM_ID_LOGOUT).withSelectable(false))
.withOnDrawerItemClickListener(this)
.withSavedInstance(savedInstanceState)
.withShowDrawerOnFirstLaunch(true)
.build();
and this is the exception im getting when trying to run:
03-16 17:33:00.454 5022-5022/com.example.videotherapystudio E/AndroidRuntime: FATAL EXCEPTION: main
Process: com.example.videotherapystudio, PID: 5022
android.content.res.Resources$NotFoundException: Resource ID #0x0
at android.content.res.Resources.getValue(Resources.java:1269)
at android.content.res.Resources.getDrawable(Resources.java:769)
at android.content.Context.getDrawable(Context.java:402)
at android.support.v4.content.ContextCompatApi21.getDrawable(ContextCompatApi21.java:26)
at android.support.v4.content.ContextCompat.getDrawable(ContextCompat.java:321)
at com.mikepenz.materialize.util.UIUtils.getSelectableBackground(UIUtils.java:353)
at com.mikepenz.materialize.util.UIUtils.getSelectableBackground(UIUtils.java:285)
at com.mikepenz.materialdrawer.model.BasePrimaryDrawerItem.bindViewHelper(BasePrimaryDrawerItem.java:78)
at com.mikepenz.materialdrawer.model.PrimaryDrawerItem.bindView(PrimaryDrawerItem.java:69)
at com.mikepenz.materialdrawer.model.PrimaryDrawerItem.bindView(PrimaryDrawerItem.java:18)
at com.mikepenz.fastadapter.FastAdapter$OnBindViewHolderListenerImpl.onBindViewHolder(FastAdapter.java:1287)
at com.mikepenz.fastadapter.FastAdapter.onBindViewHolder(FastAdapter.java:413)
at android.support.v7.widget.RecyclerView$Adapter.onBindViewHolder(RecyclerView.java:5453)
at android.support.v7.widget.RecyclerView$Adapter.bindViewHolder(RecyclerView.java:5486)
at android.support.v7.widget.RecyclerView$Recycler.getViewForPosition(RecyclerView.java:4723)
at android.support.v7.widget.RecyclerView$Recycler.getViewForPosition(RecyclerView.java:4599)
at android.support.v7.widget.LinearLayoutManager$LayoutState.next(LinearLayoutManager.java:1988)
at android.support.v7.widget.LinearLayoutManager.layoutChunk(LinearLayoutManager.java:1384)
at android.support.v7.widget.LinearLayoutManager.fill(LinearLayoutManager.java:1347)
at android.support.v7.widget.LinearLayoutManager.onLayoutChildren(LinearLayoutManager.java:574)
at android.support.v7.widget.RecyclerView.dispatchLayoutStep2(RecyclerView.java:3003)
at android.support.v7.widget.RecyclerView.dispatchLayout(RecyclerView.java:2881)
at android.support.v7.widget.RecyclerView.onLayout(RecyclerView.java:3265)
at android.view.View.layout(View.java:15631)
at android.view.ViewGroup.layout(ViewGroup.java:4966)
at android.widget.RelativeLayout.onLayout(RelativeLayout.java:1076)
at android.view.View.layout(View.java:15631)
at android.view.ViewGroup.layout(ViewGroup.java:4966)
at android.support.v4.widget.DrawerLayout.onLayout(DrawerLayout.java:1211)
at android.view.View.layout(View.java:15631)
at android.view.ViewGroup.layout(ViewGroup.java:4966)
at android.widget.FrameLayout.layoutChildren(FrameLayout.java:573)
at android.widget.FrameLayout.onLayout(FrameLayout.java:508)
at android.view.View.layout(View.java:15631)
at android.view.ViewGroup.layout(ViewGroup.java:4966)
at android.widget.LinearLayout.setChildFrame(LinearLayout.java:1705)
at android.widget.LinearLayout.layoutVertical(LinearLayout.java:1559)
at android.widget.LinearLayout.onLayout(LinearLayout.java:1468)
at android.view.View.layout(View.java:15631)
at android.view.ViewGroup.layout(ViewGroup.java:4966)
at android.widget.FrameLayout.layoutChildren(FrameLayout.java:573)
at android.widget.FrameLayout.onLayout(FrameLayout.java:508)
at android.view.View.layout(View.java:15631)
at android.view.ViewGroup.layout(ViewGroup.java:4966)
at android.view.ViewRootImpl.performLayout(ViewRootImpl.java:2101)
at android.view.ViewRootImpl.performTraversals(ViewRootImpl.java:1858)
at android.view.ViewRootImpl.doTraversal(ViewRootImpl.java:1077)
at android.view.ViewRootImpl$TraversalRunnable.run(ViewRootImpl.java:5845)
at android.view.Choreographer$CallbackRecord.run(Choreographer.java:767)
at android.view.Choreographer.doCallbacks(Choreographer.java:580)
at android.view.Choreographer.doFrame(Choreographer.java:550)
at android.view.Choreographer$FrameDisplayEventReceiver.run(Choreographer.java:753)
at android.os.Handler.handleCallback(Handler.java:739)
at android.os.Handler.dispatchMessage(Handler.java:95)
at android.os.Looper.
i tried to eliminate this error by removing anything that calls for a resource (e.g. no drawable background for header, and hard-coded strings) but to no use… still getting the above error.
i am using version 5.1.3
please help
Issue Analytics
- State:
- Created 8 years ago
- Comments:18 (10 by maintainers)
Top Results From Across the Web
android.content.res.Resources$NotFoundException ...
Resources$NotFoundException : Resource ID #0x0 ... is because you do not have a drawable resource named with the same exact name as what...
Read more >android.content.res.Resources$NotFoundException ... - GitHub
Hi, Post installation of dynamic module, if we are accessing any resource through Resources#getIdentifier(String name, String defType, ...
Read more >Error: android.content.res.Resources$NotFoundException - B4X
Resources$NotFoundException : Resource ID #0x0 at android.content.res.ResourcesImpl.getValue(ResourcesImpl.java:197) at android.content.res.
Read more >String resource ID #0x0 at android.content ... - Bugzilla@Mozilla
It has been hit by 3 users in Fennec 13.0a1 and one user in Fennec 12.0a2. It might be related to bug 666127...
Read more >android.content.res.Resources$NotFoundException - YouTube
Android : android.content.res. Resources$NotFoundException : String resource ID # 0x0 [ Beautify Your Computer ...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
I just had exactly the same problem and in my case it was solvable by adding a
android:theme="@style/MaterialDrawerTheme.*"
attribute to the activity tag in the AndroidManifest.xml. Maybe the same in your case? The cause was hard to find though and i was only lucky, because the stack trace is too long. Maybe consider it a bug…?btw: Awesome library, thank you so much! 😃 Cheers
@or-dvir oh ok. Yeah it is not recommended to use this theme 😄. The AppCompat theme will give your app a far better look across different API versions