android - AndroidRuntimeException: requestFeature() must be called before adding content exclusive to Honeycomb 3.1 - 3.2.1 -
after last update app has following issue:
java.lang.runtimeexception: unable start activity componentinfo{my.package/my.package.mymainactivity}: android.util.androidruntimeexception: requestfeature() must called before adding content @ android.app.activitythread.performlaunchactivity(activitythread.java:1818) @ android.app.activitythread.handlelaunchactivity(activitythread.java:1834) @ android.app.activitythread.access$500(activitythread.java:122) @ android.app.activitythread$h.handlemessage(activitythread.java:1027) @ android.os.handler.dispatchmessage(handler.java:99) @ android.os.looper.loop(looper.java:132) @ android.app.activitythread.main(activitythread.java:4126) @ java.lang.reflect.method.invokenative(native method) @ java.lang.reflect.method.invoke(method.java:491) @ com.android.internal.os.zygoteinit$methodandargscaller.run(zygoteinit.java:844) @ com.android.internal.os.zygoteinit.main(zygoteinit.java:602) @ dalvik.system.nativestart.main(native method) caused by: android.util.androidruntimeexception: requestfeature() must called before adding content @ com.android.internal.policy.impl.phonewindow.requestfeature(phonewindow.java:214) @ android.support.v7.app.actionbaractivitydelegatehc.oncreate(actionbaractivitydelegatehc.java:38) @ android.support.v7.app.actionbaractivity.oncreate(actionbaractivity.java:98) @ my.package.mybaseactivity.oncreate(mybaseactivity.java:68) @ my.package.myapiserviceactivity.oncreate(myapiserviceactivity.java:51) @ my.package.myactivity.oncreate(myactivity.java:88) @ android.app.instrumentation.callactivityoncreate(instrumentation.java:1050) @ android.app.activitythread.performlaunchactivity(activitythread.java:1782) ... 11 more
however, i'm never calling requestwindowfeature
or similar. there no dialogues involved either. report comes bugsense, never had problem myself. it's popular app , issue exclusive android honeycomb: 3.2, 3.2.1 , 3.1. didn't happen in previous version of app. change in oncreate
function since update fact switched actionbarsherlock
actionbarcompat
.
anyone spotted issue and/or has ideas how overcome problem?
edit: adding link the source actionbaractivitydelegatehc
v7 package crash stack trace (caused by...) starts. there requestfeature call happens, it's called correctly, before super.oncreate
.
i use gradle import package: compile 'com.android.support:appcompat-v7:18.0.+'
so looks solution @shomeser (comments question) way go time being.
there 2 ways compromise:
- if don't have different layouts landscape , portrait, can disable orientation changes (in androidmanifest:
android:configchanges="screensize|orientation"
) - if have handling on orientation change , can't use "configchanges", can lock orientation (in
oncreate
)
if(build.version.sdk_int >= build.version_codes.honeycomb || build.version.sdk_int <= build.version_codes.honeycomb_mr2) { this.setrequestedorientation( activityinfo.screen_orientation_landscape); }
- and least favourite (posting completion though), drop abc , go abs.
i posted ticket on android issue tracker, being honeycomb issue, don't expect getting answer.
update: after releasing app locked orientation specific honeycomb devices, still see crash being reported, though less frequent.
update 2: issue fixed! wait release of new support lib: google issue tracker
Comments
Post a Comment