# Problem with Android API 27 and later

**URL:** <https://forums.fusetools.com/t/problem-with-android-api-27-and-later/7430>\
**Category:** Bug Reports\
**Created:** [September 29, 2018, 11:20am UTC](https://forums.fusetools.com/t/problem-with-android-api-27-and-later/7430 "2018-09-29T11:20:51Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![acoad](https://avatars.discourse-cdn.com/v4/letter/a/59ef9b/32.png) [@acoad](https://forums.fusetools.com/u/acoad)\
**Post date:** [September 29, 2018, 11:20am UTC](https://forums.fusetools.com/t/problem-with-android-api-27-and-later/7430/1 "2018-09-29T11:20:52Z")

</div>

With Android API 27 and later, you can no longer specify screen orientation in the manifest file:

```
android:screenOrientation="portrait"

```

if you have a style setting of:

```
<item name="android:windowIsTranslucent">true</item>

```

Instead, you need to request the desired screen orientation in the onCreate method of the main activity:

```
        if (android.os.Build.VERSION.SDK_INT < Build.VERSION_CODES.O) {
        setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_PORTRAIT);
    }

```

Otherwise, your app will not run.

I need to figure out how to get the above code snippet inserted into the main activity java file as part of a ‘uno build …’ process. Does anyone know where I need to start looking in order to figure out how to do this?

AC

---

<div class="post-metadata">

**Author:** ![Matti\_Tihverainen](https://yyz1.discourse-cdn.com/flex035/user_avatar/forums.fusetools.com/matti_tihverainen/32/684_2.png) [@Matti\_Tihverainen](https://forums.fusetools.com/u/Matti_Tihverainen)\
**Post date:** [October 4, 2018, 7:19pm UTC](https://forums.fusetools.com/t/problem-with-android-api-27-and-later/7430/3 "2018-10-04T19:19:47Z")

</div>

Hello! Is this the same issue as this:

> [@REPEAT: Fuse 1.9, Android 8 failure, cannot run app](https://forums.fusetools.com/t/repeat-fuse-1-9-android-8-failure-cannot-run-app/7388):
>
> As in my post from 12 days ago, I am unable to run the app on API 26 or greater (runs fine from API 16 - 25). I can see a report from Sept 2017 of a similar issue that was resolved - I see no other issues regarding Android 8 compatibility. Environment: Fuse 1.9 Device: Sony Xperia XZ1 Compact API level 26 I would appreciate some response on this as this is holding everything up. Here is the error output when I try to run the app: java.lang.RuntimeException: Unable to start activity Compon…

---

<div class="post-metadata">

**Author:** ![ipek](https://yyz1.discourse-cdn.com/flex035/user_avatar/forums.fusetools.com/ipek/32/369_2.png) [@ipek](https://forums.fusetools.com/u/ipek)\
**Post date:** [October 4, 2018, 8:35pm UTC](https://forums.fusetools.com/t/problem-with-android-api-27-and-later/7430/4 "2018-10-04T20:35:47Z")

</div>

Hi,

We experienced the same issue a few weeks ago after making a new release for the production environment. We couldn’t find any solution in the forums and we had to fix it immediately. Since we are catching the errors through Raygun, we identified the source of the error in Java code. And the only way we could find to fix the problem was to make the necessary changes in the source code, generated by Fuse, using Android Studio and then packaged the app again using Android Studio.

It was an easy problem to fix without understanding anything about Java or Android development 🙂 However, I don’t think we will be that lucky next time!

We have invested a lot in our app developed by Fuse but unfortunately, we might have to accept the fact that it’s dying.

---

<div class="post-metadata">

**Author:** ![Matti\_Tihverainen](https://yyz1.discourse-cdn.com/flex035/user_avatar/forums.fusetools.com/matti_tihverainen/32/684_2.png) [@Matti\_Tihverainen](https://forums.fusetools.com/u/Matti_Tihverainen)\
**Post date:** [October 5, 2018, 5:46am UTC](https://forums.fusetools.com/t/problem-with-android-api-27-and-later/7430/5 "2018-10-05T05:46:21Z")

</div>

Hello ipek! Good thing that you found the solution, but could you share it with us? The reason why open source communities are dying is because people are not sharing their work and solutions to common problems. 🙂

---

<div class="post-metadata">

**Author:** ![ipek](https://yyz1.discourse-cdn.com/flex035/user_avatar/forums.fusetools.com/ipek/32/369_2.png) [@ipek](https://forums.fusetools.com/u/ipek)\
**Post date:** [October 5, 2018, 10:12am UTC](https://forums.fusetools.com/t/problem-with-android-api-27-and-later/7430/6 "2018-10-05T10:12:44Z")

</div>

Hi Matti,

As _acoad_ mentioned the problem was because of this following line:  
`<item name="android:windowIsTranslucent">true</item>`

Since there was no way of us being able to integrate the removal of this line during the`uno` build process, we installed Android Studio, found the line and removed it. And luckily, we didn’t face any problems that we couldn’t solve when we hit build in Android Studio. Basically, we are now dependant on Android Studio to make the build and packaging. This was what I advised _acoad_ to do, if, in case, he can’t find any other solution.

Believe me, if I had a better solution I would be happy to share it with the community. I can not call mine a solid solution, it was just bypassing the problem. Now I have to make a new release and shouldn’t forget to remove this line for Android 🙂

---

<div class="post-metadata">

**Author:** ![Matti\_Tihverainen](https://yyz1.discourse-cdn.com/flex035/user_avatar/forums.fusetools.com/matti_tihverainen/32/684_2.png) [@Matti\_Tihverainen](https://forums.fusetools.com/u/Matti_Tihverainen)\
**Post date:** [October 5, 2018, 10:24am UTC](https://forums.fusetools.com/t/problem-with-android-api-27-and-later/7430/7 "2018-10-05T10:24:34Z")

</div>

Thanks for the clarification!

---

<div class="post-metadata">

**Author:** ![Matti\_Tihverainen](https://yyz1.discourse-cdn.com/flex035/user_avatar/forums.fusetools.com/matti_tihverainen/32/684_2.png) [@Matti\_Tihverainen](https://forums.fusetools.com/u/Matti_Tihverainen)\
**Post date:** [November 3, 2018, 7:08pm UTC](https://forums.fusetools.com/t/problem-with-android-api-27-and-later/7430/8 "2018-11-03T19:08:29Z")

</div>

Hello! I might add that removing {“Orientations”: “Portrait”} from .unoconfig fixed this issue for me.

---

<div class="post-metadata">

**Author:** ![Matti\_Tihverainen](https://yyz1.discourse-cdn.com/flex035/user_avatar/forums.fusetools.com/matti_tihverainen/32/684_2.png) [@Matti\_Tihverainen](https://forums.fusetools.com/u/Matti_Tihverainen)\
**Post date:** [November 4, 2018, 11:09am UTC](https://forums.fusetools.com/t/problem-with-android-api-27-and-later/7430/9 "2018-11-04T11:09:08Z")

</div>

Come to think of it; for some apps it’s not convenient to allow both orientations, so if you wish to keep the orientation only to portrait, this fix works also now that Uno is open source:

1. Edit the styles.xml in Uno source: [https://github.com/fuse-open/uno/blob/8582e76cd9de40a8568ca757837cdc64211c9403/lib/UnoCore/Targets/Android/app/src/main/res/values/styles.xml](https://github.com/fuse-open/uno/blob/8582e76cd9de40a8568ca757837cdc64211c9403/lib/UnoCore/Targets/Android/app/src/main/res/values/styles.xml)
2. Change windowIsTranslucent=true to windowIsTranslucent=false
3. Build Uno with “make release” and copy over the Fuselibs/Stuff as instructed in: [Oct 2018 - How to update to latest Fuselibs and Uno](https://forums.fusetools.com/t/oct-2018-how-to-update-to-latest-fuselibs-and-uno/7480/8)

Some people are saying that defining the window’s translucency to false has some effect on splash screens (if you are using those), but i’d rather have my app not crash and is fixed to portrait mode.
