Build to Android does not work

I’m trying to build an apk but i just can not do it not matter what. The project is the unmodified basic template from the project list, this is the error:

[Error] Failed to build Gradle project into package (result code: 1). See log for more info.
[ 00:01:32.491 ]: [Error] Game building failed!

I already
Did everything from the “android setup” from the launcher, i double check the env.
I accepted the licenses with sdkmanager.bat
I have the latest JDK

I did and tried everything from here: [Error] Missing or invalid ANDROID_SDK env variable

I can see some “failed” lines on the CompileLog.txt:
Failed to detect Android NDK version (E:\Android-stuffs\Sdk\ndk)

[00:00:898] Missing VULKAN_SDK environment variable. Cannot build Vulkan.
[00:00:901] Missing VulkanSDK.

Skipped saving file to C:\Users\ME\Documents\Flax Projects\FlaxSamples\BasicTemplate\Source\BasicTemplate.Gen.cs

[00:01:442] Skipped saving file to C:\Users\ME\Documents\Flax Projects\FlaxSamples\BasicTemplate\Cache/Intermediate\BasicTemplateTarget\Android\ARM64\Development\BasicTemplate.CSharp.response
[00:01:464] Skipped saving file to C:\Users\ME\Documents\Flax Projects\FlaxSamples\BasicTemplate\Binaries\BasicTemplateTarget\Android\ARM64\Development\BasicTemplateTarget.Build.json

I’m pretty sure the directory is writable (Tested with Android Studio)
The error is just after trying to use the command gradlew.bat

Can someone help me? please :slight_smile:

faced same problem here

Ensure Android ndk is installed using android studio

i built android debug version

Comple using Android studio to open the output folder
and built apk

Make project
Screenshot 2023-09-17 201248
Build apk
Screenshot 2023-09-17 201300

tell me if you facing build problems in studio

There is an error with newer versions of gradle. It has been fixed in the flax engine master branch.

i’m facing the same error when i try to build a debug version… same error.

i do not know what you did there, but i can not see that option with the whole project opened, whatever i can see that option if i open the “app” folder inside output/android as a project but android studio shows lots of errors and i can not do anything:

Could not open init generic class cache for initialization script 'C:\Users\my name\AppData\Local\Temp\wrapper_init.gradle' (C:\Users\my name\.gradle\caches\6.5\scripts\55gw9zw830elhltgqh6dtt396\init6418c6d726070f323dbddda2aadc82ef).
> BUG! exception in phase 'semantic analysis' in source unit '_BuildScript_' Unsupported class file major version 61

* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.


can i donwload a prebuilded version? i mean a standard .exe (i do not know how is called sorry)

you have to open the android build folder

in this case it is

it should be open in android studio like this

I have attached the entire test scene folder

which has apk in
[500 Mb]
open in flax editor
and android output folder you can open in android studio.

i hope you solved the ndk missing issue ?
Check your cooker compile log

ok, thank you for your guidance, that works, i’m able to export every sample now… That being said:

  • i hope this “bug” gets fixed because it basically does not have any sense xD
  • the performance is really really bad and i tried in 3 different devices xD but i guess flax is not designed for mobile games, of course i’m going to dig into that.
    Anyways thanks again

Bad performance ?
If so, please let me know I am using Flax because of Android and C#. Let me know about the performance. And contact developers.

for what i can see it is bad, but, i tried the basic template without any modification, and you know that mobile devices needs extra work on that, so…

1 Like

Like Unity runs smoothly. Its not running like that. Right ?

well tbh, the unity’s performant on mobile is pretty good, just you know, you need to know what to do for that… this is not running like unity, is kind of bad, just a plane and a cube, not pp effects, nothing, but again, i need to dig more into that

1 Like

OMG. But share your final results here. Like you have done a hard work in building apk , you have to understand the proper mobile development with flax and getting the good performance out of it.
@A_E you have done a great job by helping this guy, thanks man. I will start work on this and will share my results also.

1 Like

This is the app running on a zuk z2, al old phone, yes, but i have an entire game running on the same phone at 50-60 xD so, is not the phone. Another weird thing is that if i tried this app on a modern phone, it runs at 4fps at max… A vulkan issue maybe?

1 Like

Edit: Vulkan maybe an issue but check your mobile drivers. 13 FPS is very low and you to need test it on modern mid-range device support vulkan 1.0 with Android 8.0 minimum. If you get same results email Developers with each and every detail of your project and Android Phone Specs.

Ask them if their engine is optimized for Android and ask about their findings. Like how much FPS they actually got in low end or mid range device. Because we are here for two things C# and Android.

the project runs at 13fps on android 8 and at 4fps on android 10 and 12.
is not my project, is the basic sample that comes with flax haha…
I’ll ask

I did not have the time to test yet for android but I am wondering if have you disabled all the postprocess effect? I think by default in the demos there is a bunch of effects activated even if it looks like they are not selected from the graphic settings, sometimes the ENABLED checkbox is not checked but the setting is activated (a little bit strange), motion blur using motion vectors, antialiasing, SSR, SSAO etc…, also in the draw mode of the object, maybe keeping only the ZBUFFER, GBUFFER and FORWARD may help for the performances ? Finally in graphic quality changing the rendering percentage may also help if the fillrate is an issue on Android, if you have a chance to test, please report here if it can improve the FPS or not.

i think the “mobile” object on the scene create overrides for all those settings, aditionaly i checked all those settings and i set them low, no pp effects, also i made a mistake, the project runs at 13fps on android 8
and at 4fps on android 10 and 12.
I eddited the other post

well looking at your screenshot on Android, I can see SSAO, tone mapping and vignette intensity are, at least activated, probably also AA, this is how it should look if everything is really disabled and if you keep the light setting from the sample, I set the windows platform instead of Android on the platform selector script to see how it should look.

I found out the way it works, you need to ENABLE the setting you want to change and then to set what you want, if you do not click ENABLED then it will probably use some default and skip the volume box override, for example to disable the TONE MAPPING , you need to select checkbox TONE MAPPING MODE and select NONE into the mode, same for the AMBIENT OCCLUSION, you need to checkbox “ENABLED” and then uncheck the RIGHT checkbox which is the ON/OFF, I got confused about this but it seems to work this way., at last in my version of the editor…

Thanks for taking the time, but, yes i got that because is exactly like unity on overrides. My main problem right now is to know why it runs better on my older phone with android 8 than the other newer devices with better CPU and RAM…