Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Hyperion Core is Incompatible with requestWindowFeature() #144

Open
GPryan opened this issue Aug 29, 2018 · 2 comments
Open

Hyperion Core is Incompatible with requestWindowFeature() #144

GPryan opened this issue Aug 29, 2018 · 2 comments

Comments

@GPryan
Copy link

GPryan commented Aug 29, 2018

We have an activity with the following onCreate() implementation:

protected void onCreate(Bundle savedInstanceState)
{
  super.onCreate(savedInstanceState);
  requestWindowFeature(Window.FEATURE_NO_TITLE);

  // And more
}

and the following manifest declaration:

<activity
	android:name="ExampleActivity"
	android:launchMode="singleTop"
	android:theme="@android:style/Theme.Holo.Light.Dialog">
</activity>

However, when including debugImplementation 'com.willowtreeapps.hyperion:hyperion-core:0.9.24', we get the following crash upon the activity starting.

java.lang.RuntimeException: Unable to start activity ComponentInfo{net.grandpad.zebra/net.grandpad.zebra.call.IncomingCallActivity}: android.util.AndroidRuntimeException: requestFeature() must be called before adding content
        at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2416)
        at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2476)
        at android.app.ActivityThread.access$900(ActivityThread.java:150)
        at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1344)
        at android.os.Handler.dispatchMessage(Handler.java:102)
        at android.os.Looper.loop(Looper.java:148)
        at android.app.ActivityThread.main(ActivityThread.java:5417)
        at java.lang.reflect.Method.invoke(Native Method)
        at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:726)
        at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:616)
     Caused by: android.util.AndroidRuntimeException: requestFeature() must be called before adding content
        at com.android.internal.policy.PhoneWindow.requestFeature(PhoneWindow.java:317)
        at android.app.Activity.requestWindowFeature(Activity.java:3690)
        at net.grandpad.zebra.call.IncomingCallActivity.onCreate(IncomingCallActivity.java:56)
        at android.app.Activity.performCreate(Activity.java:6285)
        at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1108)
        at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2369)
        at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2476) 
        at android.app.ActivityThread.access$900(ActivityThread.java:150) 
        at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1344) 
        at android.os.Handler.dispatchMessage(Handler.java:102) 
        at android.os.Looper.loop(Looper.java:148) 
        at android.app.ActivityThread.main(ActivityThread.java:5417) 
        at java.lang.reflect.Method.invoke(Native Method) 
        at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:726) 
        at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:616) 

Any help or fix would be great. Keep up the great work. Thanks!

@GPryan
Copy link
Author

GPryan commented Aug 29, 2018

I'll note, we got around this by using Theme.Holo.Light.Dialog.NoActionBar instead of requestWindowFeature(Window.FEATURE_NO_TITLE), so this is no longer an issue for us. Still could be good to fix though :)

@GPryan GPryan closed this as completed Aug 29, 2018
@GPryan GPryan reopened this Aug 29, 2018
@mezpahlan
Copy link

We have a similar problem with Hyperion and android.util.AndroidRuntimeException: requestFeature() must be called before adding content.

In our case we have a third party library creating a fullscreen activity upon receiving a broadcast (for marketing purposes). When this broadcast is received the third party library attempts to spawn a full screen activity but instead we see this crash.

As others have commented this is only an issue in builds that have Hyperion installed or the no-op version active. However, what's odd here is that we notice this crash on Android versions 5 and below.

It differs slightly from @GPryan 's issue in that we aren't setting requestWindowFeature(Window.FEATURE_NO_TITLE) (that's happening via the 3rd party library) but otherwise it appears the same.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants