Android Question How to temporarily fix "Only fullscreen opaque activities can request orientation"

fredo

Well-Known Member
Licensed User
Longtime User
For certain reasons, the targetSdk version of an app was set to 29 and uploaded to the Playstore. Since the app is already rolled out, this cannot be set to a lower level without considerable effort.

In the pre-launch report of the Google Play console, Android 8.0 devices issue the following message:
java.lang.RuntimeException: Unable to start activity ComponentInfo{a....f.main}:
java.lang.IllegalStateException: Only fullscreen opaque activities can request orientation




When searching for a solution this useful site was found next to many nebulous hints from other sources:


Since solution 3 is out of question and solution 1 ("Translucent=false" in Manifest) gave no improvement, an attempt with solution 2 brought the desired success:


After commenting out the line "#SupportedOrientations" in main a new test run was successful.



However, it is important to understand that this is not a final solution, as the line "#SupportedOrientations: portrait" is necessary and represents a reasonable setting.

If someone has successfully found a valid method, I would like to test it with my setup and use it if applicable.
 

fredo

Well-Known Member
Licensed User
Longtime User
Is your main activity a transparent activity?
It's not consciously set.

Related code in Manifest:
B4X:
CreateResource(values-v20, theme.xml,
<resources>
    <style name="LightTheme" parent="@android:style/Theme.Material.Light.NoActionBar.Fullscreen">
    
        <item name="colorAccent">#F7AC08</item>
        <item name="windowNoTitle">true</item>
        <item name="windowActionBar">false</item>
        <item name="android:windowIsTranslucent">false</item>
        <item name="android:textColorPrimary">#ffffff</item>
        <item name="android:textColorSecondary">#ffffff</item>           
    
         <item name="android:colorPrimary">@color/actionbar</item>
         <item name="android:colorPrimaryDark">@color/statusbar</item>
         <item name="android:textColorPrimary">@color/textColorPrimary</item>
         <item name="android:navigationBarColor">@color/navigationBar</item>
    </style>
</resources>
)

CreateResource(values-v14, theme.xml,
<resources>
    <style name="LightTheme" parent="@android:style/Theme.Holo.Light.NoActionBar.Fullscreen">
        <item name="android:actionBarStyle">@style/CustomActionBarStyle</item>
    </style>
    <style name="CustomActionBarStyle" parent="@android:style/Widget.Holo.Light.ActionBar.Solid.Inverse">
        <item name="android:background">@color/actionbar</item>
    </style>
</resources>
)

Resulting AndroidManifest.xml in folder .\Objects:
 
Upvote 0

fredo

Well-Known Member
Licensed User
Longtime User
There is an emulator available for Android 8 ...
Oops, I meant "At the moment there is no device or emulator for me with api 26".​

Ok, with an emulator from the Android Studio I can now reproduce the error locally, so that the test project will be quicker available.

Shutting down VM
FATAL EXCEPTION: main
Process: a...f, PID: 6119
java.lang.RuntimeException: Unable to start activity ComponentInfo{a...f/a...f.main}: java.lang.IllegalStateException: Only fullscreen opaque activities can request orientation
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2817)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2892)
at android.app.ActivityThread.-wrap11(Unknown Source:0)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1593)
at android.os.Handler.dispatchMessage(Handler.java:105)
at android.os.Looper.loop(Looper.java:164)
at android.app.ActivityThread.main(ActivityThread.java:6541)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.Zygote$MethodAndArgsCaller.run(Zygote.java:240)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:767)
Caused by: java.lang.IllegalStateException: Only fullscreen opaque activities can request orientation
at android.app.Activity.onCreate(Activity.java:986)
at a...f.main.onCreate(main.java:35)
at android.app.Activity.performCreate(Activity.java:6975)
at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1213)
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2770)
... 9 more
Deoptimizing java.lang.Object com.google.android.gms.measurement.internal.zzea.zza(java.lang.Object) due to JIT inline cache
Not supplying enough data to HAL, expected position 1081775 , only wrote 929520
File error accessing recents directory (directory doesn't exist?).
Failed to execute task.
java.util.concurrent.TimeoutException
at java.util.concurrent.FutureTask.get(FutureTask.java:206)
at com.crashlytics.android.core.CrashlyticsBackgroundWorker.submitAndWait(CrashlyticsBackgroundWorker.java:41)
at com.crashlytics.android.core.CrashlyticsController.handleUncaughtException(CrashlyticsController.java:321)
at com.crashlytics.android.core.CrashlyticsController$6.onUncaughtException(CrashlyticsController.java:301)
at com.crashlytics.android.core.CrashlyticsUncaughtExceptionHandler.uncaughtException(CrashlyticsUncaughtExceptionHandler.java:42)
at java.lang.ThreadGroup.uncaughtException(ThreadGroup.java:1068)
at java.lang.ThreadGroup.uncaughtException(ThreadGroup.java:1063)
at java.lang.Thread.dispatchUncaughtException(Thread.java:1953)
Force finishing activity a...f/.main
Background execution not allowed: receiving Intent { act=android.intent.action.DROPBOX_ENTRY_ADDED flg=0x10 (has extras) } to com.google.android.gms/.stats.service.DropBoxEntryAddedReceiver
Background execution not allowed: receiving Intent { act=android.intent.action.DROPBOX_ENTRY_ADDED flg=0x10 (has extras) } to com.google.android.gms/.chimera.GmsIntentOperationService$PersistentTrustedReceiver
Showing crash dialog for package a...f u0
Couldn't load memtrack module
failed to get memory consumption info: -1
gralloc_alloc: Creating ashmem region of size 380928
uid=1000(system) allocator@2.0-s identical 1 line
gralloc_alloc: Creating ashmem region of size 380928
eglMakeCurrent: 0xa99062e0: ver 2 0 (tinfo 0xa9957250)
Activity pause timeout for ActivityRecord{78a67da u0 a...f/.main t8 f}
Killing 4159:com.google.android.configupdater/u0a3 (adj 906): empty #17
 
Upvote 0

asales

Expert
Licensed User
Longtime User
I get this same error in Firebase, 100% in Android 8.0:
B4X:
Fatal Exception: java.lang.RuntimeException
Unable to start activity ComponentInfo{br.com.myprofile/br.com.myprofile.perfil}: java.lang.IllegalStateException: Only fullscreen opaque activities can request orientation

I don't made any change in this part of the code in my app, for several months ago and now this error is raised.

I use an transparent activity with this codes:

Manifest:
B4X:
SetActivityAttribute(Profile, android:theme, @style/Theme.Transparent)

Styles.xml
B4X:
<?xml version="1.0" encoding="utf-8"?>
<resources>
  <style name="Theme.Transparent" parent="android:Theme.Holo.Light">
    <item name="android:windowNoTitle">true</item>
    <item name="android:background">@android:color/transparent</item>
    <item name="android:windowBackground">@android:color/transparent</item>
    <item name="android:colorBackgroundCacheHint">@null</item>
    <item name="android:windowIsTranslucent">true</item>
    <item name="android:windowAnimationStyle">@android:style/Animation</item>
  </style>
</resources>
 
Upvote 0

asales

Expert
Licensed User
Longtime User
I would be interested if the error persists when you set

B4X:
<item name="android:windowIsTranslucent">false</item>
I do not have a device with Android 8.0 and I removed the transparency of the layout, which caused the error in Firebase. I will try to change this line in the other app that has less users.
 
Upvote 0

asales

Expert
Licensed User
Longtime User
I would be interested if the error persists when you set

B4X:
<item name="android:windowIsTranslucent">false</item>
To give an answer: yes, the error persists.
I tried in other app, that has the same issue int the firebase, and the problem remains.
 
Upvote 0
Cookies are required to use this site. You must accept them to continue using the site. Learn more…