[Error] Missing or invalid ANDROID_SDK env variable

Hello everyone!!

I’m trying Flax for the first time… is awesome!!
but I wanted to export an example to android, but it shows me this error.

I have sdk and set the environment variable.

I hope you can help me.

Saludos!

Welcome to the Flax forums! :wave:

It could be a few different things. The first thing I’d recommend is that you need to double-check the environment variable is set up correctly. (The name, path, etc.) Next, try restarting your computer.

If neither of those work, it’s likely an issue with the SDK. I use the Android 10.0 (API level 29) SDK and have no issues.

1 Like

Thank you Spectrix!

Reinstall all android studio and only Android 10.0 (API level 29) and set environment variables again. and it worked!! I think so.
Now it shows me another error! :stuck_out_tongue_closed_eyes:
I don’t know what this error is about.

Could you share your log file? I think it should be located at \project-path\Cache\Cooker\Android.

[00:00:002] Flax.Build 1.0.8284
[00:00:003]   Arguments: -log -logfile="C:\Users/Jose/Documents/Flax Projects/FlaxSamples/GraphicsFeaturesTour/Cache/Cooker/Android/CompileLog.txt" -build -mutex -buildtargets=GraphicsFeaturesTourTarget -platform=Android -arch=ARM64 -configuration=Development
[00:00:003]   Workspace: C:\Users\Jose\Documents\Flax Projects\FlaxSamples\GraphicsFeaturesTour
[00:00:003]   Engine: K:\program files\Flax\Flax_1.4
[00:00:007] Loading project file from "C:\Users\Jose\Documents\Flax Projects\FlaxSamples\GraphicsFeaturesTour\GraphicsFeaturesTour.flaxproj"...
[00:00:128] Loading project file from "K:\program files\Flax\Flax_1.4\Flax.flaxproj"...
[00:00:145] Loaded project Flax, version 1.4.6334
[00:00:145] Loaded project Graphics Features Tour, version 1.0
[00:00:527] Building targets...
[00:00:540] Found Android SDK at C:\Users\Jose\AppData\Local\Android\Sdk
[00:00:541] Found Android NDK 25.2.9519653 at C:\Users\Jose\AppData\Local\Android\Sdk\ndk\25.2.9519653
[00:00:542] Missing Linux Toolchain. Cannot build for Linux platform.
[00:00:550] Found Windows SDK v10_0_18362_0 at C:\Program Files (x86)\Windows Kits\10\
[00:00:550] Found Windows SDK v10_0_19041_0 at C:\Program Files (x86)\Windows Kits\10\
[00:00:550] Found Windows SDK v10_0_22000_0 at C:\Program Files (x86)\Windows Kits\10\
[00:00:550] Found Windows SDK v10_0_22621_0 at C:\Program Files (x86)\Windows Kits\10\
[00:00:562] Found VisualStudio2022 at C:\Program Files\Microsoft Visual Studio\2022\Community
[00:00:562] Found VisualStudio2019 at C:\Program Files (x86)\Microsoft Visual Studio\2019\Community
[00:00:565] Found Windows toolset v143 at C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.34.31933
[00:00:565] Found Windows toolset v142 at C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Tools\MSVC\14.29.30037
[00:00:568] Building C# only
[00:00:568] Building target GraphicsFeaturesTourTarget in Development for Android ARM64
[00:00:794] Building referenced target Flax
[00:00:818] Parsing API bindings for Profiler (FlaxEngine)
[00:00:876] Parsing API bindings for Platform (FlaxEngine)
[00:00:942] Parsing API bindings for Core (FlaxEngine)
[00:01:536] Parsing API bindings for Visject (FlaxEngine)
[00:01:542] Parsing API bindings for Animations (FlaxEngine)
[00:01:573] Parsing API bindings for Audio (FlaxEngine)
[00:01:587] Parsing API bindings for TextureTool (FlaxEngine)
[00:01:587] Parsing API bindings for ModelTool (FlaxEngine)
[00:01:589] Found VulkanSDK at: C:\VulkanSDK\1.3.239.0
[00:01:593] Parsing API bindings for Graphics (FlaxEngine)
[00:01:816] Parsing API bindings for Utilities (FlaxEngine)
[00:01:819] Parsing API bindings for Particles (FlaxEngine)
[00:01:835] Parsing API bindings for Content (FlaxEngine)
[00:01:911] Parsing API bindings for Debug (FlaxEngine)
[00:01:947] Parsing API bindings for Foliage (FlaxEngine)
[00:01:955] Parsing API bindings for Renderer (FlaxEngine)
[00:01:969] Parsing API bindings for Render2D (FlaxEngine)
[00:02:026] Parsing API bindings for Input (FlaxEngine)
[00:02:057] Parsing API bindings for Physics (FlaxEngine)
[00:02:168] Parsing API bindings for Scripting (FlaxEngine)
[00:02:211] Parsing API bindings for Serialization (FlaxEngine)
[00:02:213] Parsing API bindings for Level (FlaxEngine)
[00:02:337] Parsing API bindings for Navigation (FlaxEngine)
[00:02:349] Parsing API bindings for Networking (FlaxEngine)
[00:02:358] Parsing API bindings for Streaming (FlaxEngine)
[00:02:361] Parsing API bindings for Terrain (FlaxEngine)
[00:02:369] Parsing API bindings for Threading (FlaxEngine)
[00:02:373] Parsing API bindings for Localization (FlaxEngine)
[00:02:378] Parsing API bindings for UI (FlaxEngine)
[00:02:383] Parsing API bindings for Online (FlaxEngine)
[00:02:385] Parsing API bindings for Engine (FlaxEngine)
[00:02:397] Building module tracy
[00:02:401] Building module Profiler
[00:02:401] Building module Platform
[00:02:401] Building module fmt
[00:02:401] Building module Core
[00:02:401] Building module Main
[00:02:401] Building module Visject
[00:02:401] Building module Animations
[00:02:401] Building module minimp3
[00:02:401] Building module ogg
[00:02:402] Building module vorbis
[00:02:402] Building module AudioTool
[00:02:402] Building module Audio
[00:02:402] Building module lz4
[00:02:402] Building module stb
[00:02:402] Building module TextureTool
[00:02:402] Building module ModelTool
[00:02:402] Building module VulkanMemoryAllocator
[00:02:402] Building module volk
[00:02:402] Building module GraphicsDeviceVulkan
[00:02:402] Building module Graphics
[00:02:402] Building module Utilities
[00:02:402] Building module Particles
[00:02:402] Building module Content
[00:02:402] Building module Debug
[00:02:402] Building module Foliage
[00:02:402] Building module Renderer
[00:02:402] Building module freetype
[00:02:402] Building module Render2D
[00:02:402] Building module Input
[00:02:402] Building module PhysX
[00:02:402] Building module Physics
[00:02:402] Building module mono
[00:02:402] Building module Scripting
[00:02:402] Building module rapidjson
[00:02:402] Building module Serialization
[00:02:402] Building module Level
[00:02:402] Building module recastnavigation
[00:02:402] Building module Navigation
[00:02:402] Building module Networking
[00:02:402] Building module Streaming
[00:02:402] Building module Terrain
[00:02:402] Building module Threading
[00:02:402] Building module Localization
[00:02:402] Building module UI
[00:02:402] Building module Online
[00:02:402] Building module Engine
[00:02:404] Skipping build for target FlaxGame
[00:02:405] Engine build version: 1.4.6334
[00:02:415] Generating binary module bindings for GraphicsFeaturesTour
[00:02:420] Skipped saving file to C:\Users\Jose\Documents\Flax Projects\FlaxSamples\GraphicsFeaturesTour\Source\GraphicsFeaturesTour.Gen.cs
[00:02:420] Building module GraphicsFeaturesTour
[00:02:428] Skipped saving file to C:\Users\Jose\Documents\Flax Projects\FlaxSamples\GraphicsFeaturesTour\Cache/Intermediate\GraphicsFeaturesTourTarget\Android\ARM64\Development\GraphicsFeaturesTour.CSharp.response
[00:02:457] Skipped saving file to C:\Users\Jose\Documents\Flax Projects\FlaxSamples\GraphicsFeaturesTour\Binaries\GraphicsFeaturesTourTarget\Android\ARM64\Development\GraphicsFeaturesTourTarget.Build.json
[00:02:465] Found 15 valid and 0 invalid actions in Task Graph cache
[00:02:466] 
[00:02:466] Total 3 tasks
[00:02:467] Done!
[00:02:467] Total time: 00:00:02.4721738
[00:02:467] End.

i try to reinstall Gradle and set env. vars too… but show the same error in output log.

Well, I can’t spot anything out of the ordinary. The only other thing I can recommend is to make sure there aren’t any compile errors with your scripts. That’s caused me weird build errors in the past. Maybe @mafiesto4 can help you more.

Probably you need to run Android Studio and accept software licenses (some help: android - Automatically accept all SDK licences - Stack Overflow).

Example gardle log with similar issue:

All projects evaluated.
Configuring Java sources compilation with source level 1.7 and target level 1.7.
Selected primary task 'assembleDebug' from project :
Checking the license for package Android SDK Platform-Tools in D:\Programs\Android\android-studio\licenses
Warning: License for package Android SDK Platform-Tools not accepted.
Checking the license for package SDK Patch Applier v4 in D:\Programs\Android\android-studio\licenses
Warning: License for package SDK Patch Applier v4 not accepted.
Checking the license for package Android Emulator in D:\Programs\Android\android-studio\licenses
Warning: License for package Android Emulator not accepted.
Checking the license for package Android SDK Tools in D:\Programs\Android\android-studio\licenses
Warning: License for package Android SDK Tools not accepted.
Checking the license for package Android SDK Build-Tools 29.0.2 in D:\Programs\Android\android-studio\licenses
Warning: License for package Android SDK Build-Tools 29.0.2 not accepted.
Checking the license for package Android SDK Platform 24 in D:\Programs\Android\android-studio\licenses
Warning: License for package Android SDK Platform 24 not accepted.

FAILURE: Build failed with an exception.

* What went wrong:
Could not determine the dependencies of task ':app:compileDebugJavaWithJavac'.
> Failed to install the following Android SDK packages as some licences have not been accepted.
     patcher;v4 SDK Patch Applier v4
     platform-tools Android SDK Platform-Tools
     platforms;android-24 Android SDK Platform 24
     emulator Android Emulator
     tools Android SDK Tools
     build-tools;29.0.2 Android SDK Build-Tools 29.0.2
  To build this project, accept the SDK license agreements and install the missing components using the Android Studio SDK Manager.
  Alternatively, to transfer the license agreements from one workstation to another, see http://d.android.com/r/studio-ui/export-licenses.html

  Using Android SDK: D:\Programs\Android\android-studio

I’ll update docs to reflect this info.

It looks like Android toolchain has been changed since we’ve added support for this platform thus the latest SDK/NDK version has some issues with setup. I updated Flax toolchain and docs to reflect this:

new docs:

1 Like

Thanks maiesto4!!
I haven’t slept trying to find a solution.
a

So, does it mean that the android option does’t work until a new 1.5 update?
or I can update the “Improve building” in my flax.
I’m a newbie… I’m learning about all this. :slight_smile:

thanks!

You can wait for 1.5 update which might come out this week (I hope so). I just tested and it correctly produces .apk which runs fine on Android phone.

1 Like

Awesome!!! I’ll be waiting it!! :smiley:
I want to tell you that I am a visual artist and I have an art project in mind, so I am learning about game development. and I’ve been looking for a game engine for several months, testing them… and I recently found Flax Engine (the 9th one I’ve tried) and it seems amazing!! :100:

1 Like

New error on 1.5.
help!

Have you tried removing <project>\Output\Android folder to have clean build with Flax 1.5?
What Android SDK version do you have installed? That’s how it looks on my PC:

image

Flax 1.5.6339 now it works!!! :smiley: :smiley:
thanks u!
Screenshot_1