Android cannot start Activity - java.lang.RuntimeException: Unable to start activity ComponentInfo -
here's problem that's getting me, whenever try launch application's main activity, error in logcat:
java.lang.runtimeexception: unable start activity componentinfo{me.kworden.atic/me.kworden.atic.mainactivity}: android.content.res.resources$notfoundexception: resource id #0x7f0c00a9
the stack trace says problem super.oncreate(savedinstancestate)
in oncreate()
method, frustrating me, because can't control superclass method.
the content layout i'm using linearlayout
, don't think necessary see xml file, although post on request.
i've seen other similar problems on so, answers "clean/rebuild project" hasn't done me. i'm using android studio ver. 1.1.0 if known problem, haven't seen known bugs.
here mainactivity, i've stripped out of code in order pinpoint problem, seems super.oncreate
culprit; despite being extremely barebones, app still fails start (i.e. "unfortunately, app has stopped.").
import android.support.v7.app.actionbaractivity; import android.os.bundle; import android.view.menu; import android.view.menuitem; public class mainactivity extends actionbaractivity { @override protected void oncreate(bundle savedinstancestate) { // create activity , set main content view // super.oncreate(savedinstancestate); // line 17, per stack trace // setcontentview(r.layout.activity_main); } @override public boolean oncreateoptionsmenu(menu menu) { // inflate main menu toolbar // getmenuinflater().inflate(r.menu.menu_main, menu); return true; } @override public boolean onoptionsitemselected(menuitem item) { int id = item.getitemid(); if(id == r.id.action_settings) { return true; } return super.onoptionsitemselected(item); } }
here full stack trace:
03-16 23:16:33.572 1494-1494/me.kworden.atic e/androidruntime﹕ fatal exception: main process: me.kworden.atic, pid: 1494 java.lang.runtimeexception: unable start activity componentinfo{me.kworden.atic/me.kworden.atic.mainactivity}: android.content.res.resources$notfoundexception: resource id #0x7f0c00a9 @ android.app.activitythread.performlaunchactivity(activitythread.java:2298) @ android.app.activitythread.handlelaunchactivity(activitythread.java:2360) @ android.app.activitythread.access$800(activitythread.java:144) @ android.app.activitythread$h.handlemessage(activitythread.java:1278) @ android.os.handler.dispatchmessage(handler.java:102) @ android.os.looper.loop(looper.java:135) @ android.app.activitythread.main(activitythread.java:5221) @ java.lang.reflect.method.invoke(native method) @ java.lang.reflect.method.invoke(method.java:372) @ com.android.internal.os.zygoteinit$methodandargscaller.run(zygoteinit.java:899) @ com.android.internal.os.zygoteinit.main(zygoteinit.java:694) caused by: android.content.res.resources$notfoundexception: resource id #0x7f0c00a9 @ android.content.res.resources.getvalue(resources.java:1233) @ android.content.res.resources.getdrawable(resources.java:756) @ android.content.context.getdrawable(context.java:402) @ com.android.internal.policy.impl.phonewindow.generatelayout(phonewindow.java:3514) @ com.android.internal.policy.impl.phonewindow.installdecor(phonewindow.java:3561) @ com.android.internal.policy.impl.phonewindow.getdecorview(phonewindow.java:1916) @ android.support.v7.app.actionbaractivitydelegatebase.oncreate(actionbaractivitydelegatebase.java:151) @ android.support.v7.app.actionbaractivity.oncreate(actionbaractivity.java:123) @ me.kworden.atic.mainactivity.oncreate(mainactivity.java:17) @ android.app.activity.performcreate(activity.java:5933) @ android.app.instrumentation.callactivityoncreate(instrumentation.java:1105) @ android.app.activitythread.performlaunchactivity(activitythread.java:2251) at android.app.activitythread.handlelaunchactivity(activitythread.java:2360) at android.app.activitythread.access$800(activitythread.java:144) at android.app.activitythread$h.handlemessage(activitythread.java:1278) at android.os.handler.dispatchmessage(handler.java:102) at android.os.looper.loop(looper.java:135) at android.app.activitythread.main(activitythread.java:5221) at java.lang.reflect.method.invoke(native method) at java.lang.reflect.method.invoke(method.java:372) at com.android.internal.os.zygoteinit$methodandargscaller.run(zygoteinit.java:899) at com.android.internal.os.zygoteinit.main(zygoteinit.java:694)
if stumbles on in future want make sure can answer...
the problem tags available material , android 5.0+ being used in styles. instead made res/values-v21/styles.xml
folder , put appropriate settings in there. fixed issue.
Comments
Post a Comment