i have terrible time trying find out whats wrong problem. when trying click button in app following error:
android.view.inflateexception: binary xml file line #31: error inflating class com.android.internal.widget.actionbarcontainer
here manifest file:
<?xml version="1.0" encoding="utf-8"?> <manifest xmlns:android="http://schemas.android.com/apk/res/android" package="com.example.anders.ugym" android:versioncode="1" android:versionname="1.0" > <uses-permission android:name="android.permission.internet" /> <uses-permission android:name="android.permission.access_network_state" /> <uses-sdk android:minsdkversion="11" android:targetsdkversion="23" /> <application android:allowbackup="true" android:icon="@mipmap/ic_launcher" android:label="@string/app_name" android:theme="@style/apptheme"> <activity android:name=".loginactivity" android:label="@string/app_name" > <intent-filter> <action android:name="android.intent.action.main" /> <category android:name="android.intent.category.launcher" /> </intent-filter> </activity> <activity android:name=".mainactivity" android:label="@string/app_name" android:theme="@style/themeoverlay.appcompat.actionbar"> <intent-filter> <action android:name="android.intent.action.main" /> <category android:name="android.intent.category.launcher" /> </intent-filter> </activity> <activity android:name=".registeractivity" /> <activity android:name=".todoactivity" /> </application> </manifest>
and styles.xml:
<!-- base application theme. --> <style name="apptheme" parent="base.theme.appcompat.light.darkactionbar"> <!-- customize theme here. --> </style> <style name="apptheme.noactionbar"> <item name="windowactionbar">false</item> <item name="windownotitle">true</item> </style> <style name="apptheme.appbaroverlay" parent="themeoverlay.appcompat.dark.actionbar" /> <style name="apptheme.popupoverlay" parent="themeoverlay.appcompat.light" />
and activity_register.xml:
<linearlayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools" android:layout_width="match_parent" android:layout_height="match_parent" android:orientation="vertical" android:paddingbottom="@dimen/activity_vertical_margin" android:paddingleft="@dimen/activity_horizontal_margin" android:paddingright="@dimen/activity_horizontal_margin" android:paddingtop="@dimen/activity_vertical_margin" tools:context=".registeractivity" > <linearlayout android:layout_width="match_parent" android:layout_height="0dp" android:layout_weight="1" android:gravity="center_vertical" android:orientation="vertical" > <textview android:id="@+id/error_messages" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_gravity="center_horizontal" android:textcolor="@color/red" android:textappearance="?android:attr/textappearancemedium" /> <textview android:layout_width="match_parent" android:layout_height="wrap_content" android:text="@string/username" /> <edittext android:id="@+id/register_username" android:layout_width="match_parent" android:layout_height="wrap_content" android:ems="10" android:inputtype="text" > <requestfocus /> </edittext> <textview android:layout_width="match_parent" android:layout_height="wrap_content" android:text="@string/password_label" /> <edittext android:id="@+id/register_password" android:layout_width="match_parent" android:layout_height="wrap_content" android:ems="10" android:inputtype="textpassword" /> <button android:id="@+id/sign_up" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_gravity="right" android:onclick="register" android:text="@string/sign_up_label" /> </linearlayout> <button android:id="@+id/signinbutton" android:layout_width="match_parent" android:layout_height="wrap_content" android:textsize="17sp" android:onclick="showlogin" android:text="@string/already_have_an_account_label" /> </linearlayout>
my exception:
java.lang.runtimeexception: unable start activity componentinfo{com.example.anders.ugym/com.example.anders.ugym.mainactivity}: android.view.inflateexception: binary xml file line #31: error inflating class com.android.internal.widget.actionbarcontainer @ android.app.activitythread.performlaunchactivity(activitythread.java:2325) @ android.app.activitythread.handlelaunchactivity(activitythread.java:2387) @ android.app.activitythread.access$800(activitythread.java:151) @ android.app.activitythread$h.handlemessage(activitythread.java:1303) @ android.os.handler.dispatchmessage(handler.java:102) @ android.os.looper.loop(looper.java:135) @ android.app.activitythread.main(activitythread.java:5254) @ java.lang.reflect.method.invoke(native method) @ java.lang.reflect.method.invoke(method.java:372) @ com.android.internal.os.zygoteinit$methodandargscaller.run(zygoteinit.java:903) @ com.android.internal.os.zygoteinit.main(zygoteinit.java:698) caused by: android.view.inflateexception: binary xml file line #31: error inflating class com.android.internal.widget.actionbarcontainer @ android.view.layoutinflater.createview(layoutinflater.java:633) @ android.view.layoutinflater.createviewfromtag(layoutinflater.java:743) @ android.view.layoutinflater.rinflate(layoutinflater.java:806) @ android.view.layoutinflater.inflate(layoutinflater.java:504) @ android.view.layoutinflater.inflate(layoutinflater.java:414) @ android.view.layoutinflater.inflate(layoutinflater.java:365) @ com.android.internal.policy.impl.phonewindow.generatelayout(phonewindow.java:3605) @ com.android.internal.policy.impl.phonewindow.installdecor(phonewindow.java:3677) @ com.android.internal.policy.impl.phonewindow.setcontentview(phonewindow.java:368) @ android.app.activity.setcontentview(activity.java:2145) @ com.example.anders.ugym.mainactivity.oncreate(mainactivity.java:26) @ android.app.activity.performcreate(activity.java:5990) @ android.app.instrumentation.callactivityoncreate(instrumentation.java:1106) @ android.app.activitythread.performlaunchactivity(activitythread.java:2278) @ android.app.activitythread.handlelaunchactivity(activitythread.java:2387) @ android.app.activitythread.access$800(activitythread.java:151) @ android.app.activitythread$h.handlemessage(activitythread.java:1303) @ android.os.handler.dispatchmessage(handler.java:102) @ android.os.looper.loop(looper.java:135) @ android.app.activitythread.main(activitythread.java:5254) @ java.lang.reflect.method.invoke(native method) @ java.lang.reflect.method.invoke(method.java:372) @ com.android.internal.os.zygoteinit$methodandargscaller.run(zygoteinit.java:903) @ com.android.internal.os.zygoteinit.main(zygoteinit.java:698) caused by: java.lang.reflect.invocationtargetexception @ java.lang.reflect.constructor.newinstance(native method) @ java.lang.reflect.constructor.newinstance(constructor.java:288) @ android.view.layoutinflater.createview(layoutinflater.java:607) @ android.view.layoutinflater.createviewfromtag(layoutinflater.java:743) @ android.view.layoutinflater.rinflate(layoutinflater.java:806) @ android.view.layoutinflater.inflate(layoutinflater.java:504) @ android.view.layoutinflater.inflate(layoutinflater.java:414) @ android.view.layoutinflater.inflate(layoutinflater.java:365) @ com.android.internal.policy.impl.phonewindow.generatelayout(phonewindow.java:3605) @ com.android.internal.policy.impl.phonewindow.installdecor(phonewindow.java:3677) @ com.android.internal.policy.impl.phonewindow.setcontentview(phonewindow.java:368) @ android.app.activity.setcontentview(activity.java:2145) @ com.example.anders.ugym.mainactivity.oncreate(mainactivity.java:26) @ android.app.activity.performcreate(activity.java:5990) @ android.app.instrumentation.callactivityoncreate(instrumentation.java:1106) @ android.app.activitythread.performlaunchactivity(activitythread.java:2278) @ android.app.activitythread.handlelaunchactivity(activitythread.java:2387) @ android.app.activitythread.access$800(activitythread.java:151) @ android.app.activitythread$h.handlemessage(activitythread.java:1303) @ android.os.handler.dispatchmessage(handler.java:102) @ android.os.looper.loop(looper.java:135) @ android.app.activitythread.main(activitythread.java:5254) @ java.lang.reflect.method.invoke(native method) @ java.lang.reflect.method.invoke(method.java:372) @ com.android.internal.os.zygoteinit$methodandargscaller.run(zygoteinit.java:903) @ com.android.internal.os.zygoteinit.main(zygoteinit.java:698) caused by: java.lang.runtimeexception: failed resolve attribute @ index 13 @ android.content.res.typedarray.getdrawable(typedarray.java:747) @ android.view.view.<init>(view.java:3737) @ android.view.viewgroup.<init>(viewgroup.java:497) @ android.widget.framelayout.<init>(framelayout.java:115) @ android.widget.framelayout.<init>(framelayout.java:111) @ android.widget.framelayout.<init>(framelayout.java:107) @ com.android.internal.widget.actionbarcontainer.<init>(actionbarcontainer.java:60) @ java.lang.reflect.constructor.newinstance(native method) @ java.lang.reflect.constructor.newinstance(constructor.java:288) @ android.view.layoutinflater.createview(layoutinflater.java:607) @ android.view.layoutinflater.createviewfromtag(layoutinflater.java:743) @ android.view.layoutinflater.rinflate(layoutinflater.java:806) @ android.view.layoutinflater.inflate(layoutinflater.java:504) @ android.view.layoutinflater.inflate(layoutinflater.java:414) @ android.view.layoutinflater.inflate(layoutinflater.java:365) @ com.android.internal.policy.impl.phonewindow.generatelayout(phonewindow.java:3605) @ com.android.internal.policy.impl.phonewindow.installdecor(phonewindow.java:3677) @ com.android.internal.policy.impl.phonewindow.setcontentview(phonewindow.java:368) @ android.app.activity.setcontentview(activity.java:2145) @ com.example.anders.ugym.mainactivity.oncreate(mainactivity.java:26) @ android.app.activity.performcreate(activity.java:5990) @ android.app.instrumentation.callactivityoncreate(instrumentation.java:1106) @ android.app.activitythread.performlaunchactivity(activitythread.java:2278) @ android.app.activitythread.handlelaunchactivity(activitythread.java:2387) @ android.app.activitythread.access$800(activitythread.java:151) @ android.app.activitythread$h.handlemessage(activitythread.java:1303) @ android.os.handler.dispatchmessage(handler.java:102) @ android.os.looper.loop(looper.java:135) @ android.app.activitythread.main(activitythread.java:5254) @ java.lang.reflect.method.invoke(native method) @ java.lang.reflect.method.invoke(method.java:372) @ com.android.internal.os.zygoteinit$methodandargscaller.run(zygoteinit.java:903) @ com.android.internal.os.zygoteinit.main(zygoteinit.java:698)
as mentioned in this post neel0507:
i had same error, , here how dealt it. in styles.xml file, in first "apptheme" style put base infront of theme.appcompat. "base.theme.appcompat.light.darkactionbar".
after this, go "androidmanifest" , in activity not use "appbaroverlay". "android:theme="@style/apptheme".
furthermore, in "androidmanifest" remove "package name" activity name, , use ".settingsactivity".
if have other activities instead of defining apptheme in each activity, use android:parentactivityname=".settingsactivity."
i know want have action bar , removing appbaroverlay help. let me know if works.
hopes it's helps..
Comments
Post a Comment