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?
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.
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.
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 theuno 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
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:
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.