上次更新后,我的应用出现以下问题:
java.lang.RuntimeException: Unable to start activity ComponentInfo{my.package/my.package.MyMainActivity}: android.util.AndroidRuntimeException: requestFeature() must be called before adding content
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1818)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:1834)
at android.app.ActivityThread.access$500(ActivityThread.java:122)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1027)
at android.os.Handler.dispatchMessage(Handler.java:99)
at android.os.Looper.loop(Looper.java:132)
at android.app.ActivityThread.main(ActivityThread.java:4126)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:491)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:844)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:602)
at dalvik.system.NativeStart.main(Native Method)
Caused by: android.util.AndroidRuntimeException: requestFeature() must be called before adding content
at com.android.internal.policy.impl.PhoneWindow.requestFeature(PhoneWindow.java:214)
at android.support.v7.app.ActionBarActivityDelegateHC.onCreate(ActionBarActivityDelegateHC.java:38)
at android.support.v7.app.ActionBarActivity.onCreate(ActionBarActivity.java:98)
at my.package.MyBaseActivity.onCreate(MyBaseActivity.java:68)
at my.package.MyApiServiceActivity.onCreate(MyApiServiceActivity.java:51)
at my.package.MyActivity.onCreate(MyActivity.java:88)
at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1050)
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1782)
... 11 more
但是,我从不打电话requestWindowFeature
或类似情况。也没有涉及对话。报告本身来自BugSense,我自己从来没有遇到过这个问题。这是一个相当流行的应用程序,该问题是Android Honeycomb独有的:3.2、3.2.1 和 3.1。在以前版本的应用程序中没有发生这种情况。自更新以来功能的唯一变化是我从.onCreate
ActionBarSherlock
ActionBarCompat
任何人也发现了这个问题和/或有任何想法如何克服这个问题?
编辑:
我正在添加从 v7 包的源ActionBarActivityDelegateHC
链接到崩溃堆栈跟踪(由...引起)开始的地方。那里发生了 requestFeature 调用,但它被正确调用,甚至在super.onCreate
.
我使用 Gradle 导入包:compile 'com.android.support:appcompat-v7:18.0.+'