java - Unfortunately, (app name) has stopped - Android development error -
i learning develop android applications , have come across problem in first project. following tutorial (derek banas) create app allow user type in text, hit button , app output text. have written code , have recieved no errors, whenever run app on emulator, says "unfortunately, (app name) has stopped. here log cat:
08-23 17:51:36.026: d/androidruntime(800): shutting down vm 08-23 17:51:36.063: w/dalvikvm(800): threadid=1: thread exiting uncaught exception (group=0x414c4700) 08-23 17:51:36.196: e/androidruntime(800): fatal exception: main 08-23 17:51:36.196: e/androidruntime(800): java.lang.runtimeexception: unable start activity componentinfo{com.nick.android.nick/com.nick.android.nick.mainactivity}: java.lang.runtimeexception: binary xml file line #12: must supply layout_height attribute. 08-23 17:51:36.196: e/androidruntime(800): @ android.app.activitythread.performlaunchactivity(activitythread.java:2211) 08-23 17:51:36.196: e/androidruntime(800): @ android.app.activitythread.handlelaunchactivity(activitythread.java:2261) 08-23 17:51:36.196: e/androidruntime(800): @ android.app.activitythread.access$600(activitythread.java:141) 08-23 17:51:36.196: e/androidruntime(800): @ android.app.activitythread$h.handlemessage(activitythread.java:1256) 08-23 17:51:36.196: e/androidruntime(800): @ android.os.handler.dispatchmessage(handler.java:99) 08-23 17:51:36.196: e/androidruntime(800): @ android.os.looper.loop(looper.java:137) 08-23 17:51:36.196: e/androidruntime(800): @ android.app.activitythread.main(activitythread.java:5103) 08-23 17:51:36.196: e/androidruntime(800): @ java.lang.reflect.method.invokenative(native method) 08-23 17:51:36.196: e/androidruntime(800): @ java.lang.reflect.method.invoke(method.java:525) 08-23 17:51:36.196: e/androidruntime(800): @ com.android.internal.os.zygoteinit$methodandargscaller.run(zygoteinit.java:737) 08-23 17:51:36.196: e/androidruntime(800): @ com.android.internal.os.zygoteinit.main(zygoteinit.java:553) 08-23 17:51:36.196: e/androidruntime(800): @ dalvik.system.nativestart.main(native method) 08-23 17:51:36.196: e/androidruntime(800): caused by: java.lang.runtimeexception: binary xml file line #12: must supply layout_height attribute. 08-23 17:51:36.196: e/androidruntime(800): @ android.content.res.typedarray.getlayoutdimension(typedarray.java:491) 08-23 17:51:36.196: e/androidruntime(800): @ android.view.viewgroup$layoutparams.setbaseattributes(viewgroup.java:5820) 08-23 17:51:36.196: e/androidruntime(800): @ android.view.viewgroup$marginlayoutparams.<init>(viewgroup.java:5988) 08-23 17:51:36.196: e/androidruntime(800): @ android.widget.linearlayout$layoutparams.<init>(linearlayout.java:1831) 08-23 17:51:36.196: e/androidruntime(800): @ android.widget.linearlayout.generatelayoutparams(linearlayout.java:1743) 08-23 17:51:36.196: e/androidruntime(800): @ android.widget.linearlayout.generatelayoutparams(linearlayout.java:58) 08-23 17:51:36.196: e/androidruntime(800): @ android.view.layoutinflater.rinflate(layoutinflater.java:757) 08-23 17:51:36.196: e/androidruntime(800): @ android.view.layoutinflater.inflate(layoutinflater.java:492) 08-23 17:51:36.196: e/androidruntime(800): @ android.view.layoutinflater.inflate(layoutinflater.java:397) 08-23 17:51:36.196: e/androidruntime(800): @ android.view.layoutinflater.inflate(layoutinflater.java:353) 08-23 17:51:36.196: e/androidruntime(800): @ com.android.internal.policy.impl.phonewindow.setcontentview(phonewindow.java:267) 08-23 17:51:36.196: e/androidruntime(800): @ android.app.activity.setcontentview(activity.java:1895) 08-23 17:51:36.196: e/androidruntime(800): @ com.nick.android.nick.mainactivity.oncreate(mainactivity.java:17) 08-23 17:51:36.196: e/androidruntime(800): @ android.app.activity.performcreate(activity.java:5133) 08-23 17:51:36.196: e/androidruntime(800): @ android.app.instrumentation.callactivityoncreate(instrumentation.java:1087) 08-23 17:51:36.196: e/androidruntime(800): @ android.app.activitythread.performlaunchactivity(activitythread.java:2175) 08-23 17:51:36.196: e/androidruntime(800): ... 11 more
the error comes mainactivitys
method setcontentview(...).
the xml layout file setting activity contains view not have layout_height
property. layout_height
, layout_width
required on every view.
this information available in logcat excerpt posted:
08-23 17:51:36.196: e/androidruntime(800): caused by: java.lang.runtimeexception: binary xml file line #12: must supply layout_height attribute.
Comments
Post a Comment