magnum-bootstrap
magnum-bootstrap copied to clipboard
ANDROID_SDK variable has wrong path on Windows.
@mosra Hey Vladimir.
One issue I have found in the Android Bootstrap project.
It looks like ANDROID_SDK path search is not cross-platform:
get_filename_component(ANDROID_SDK ${CMAKE_ANDROID_NDK}/../android-sdk/ REALPATH CACHE)
Not sure what should be the right approach here.
I have modified your config on Windows to use the environment variable ANDROID_HOME.
For example my default NDK location on Windows is:
export ANDROID_NDK_HOME=/c/Users/<user>/AppData/Local/Android/Sdk/ndk/20.0.5594570
After my modification, I can generate and install .apk.
coming form here https://github.com/mosra/toolchains/blob/99954afbab3b2a9e3ba518edccc8379733080db9/modules/UseAndroid.cmake
Argh, this kinda slipped through -- too many things happening all the time, sorry.
Not sure what should be the right approach here.
I think what would work is passing -DANDROID_SDK=c:/Users/<user>/AppData/Local/Android/Sdk
to CMake explicitly. But an autodetection would be nicer, for sure.
use the environment variable ANDROID_HOME
You mean ANDROID_NDK_HOME
, right? Is there no other env variable that could make this easier?
If you have a patch that makes this work, can you share it here?
Android Studio is deprecating env variables and all should be set-up by the Gradle project.
But if you run ./gradle build
from CLI it requires to setup ANDROID_HOME.
It would be useful to be able to pass ANDROID_SDK as ENV here as well.
I would add those lines above line 38: if(NOT ANDROID_SDK)
https://github.com/mosra/toolchains/blob/99954afbab3b2a9e3ba518edccc8379733080db9/modules/UseAndroid.cmake#L38
if (DEFINED ENV{ANDROID_SDK})
message( STATUS "ANDROID_SDK is defined as environment variable $ENV{ANDROID_SDK}")
set(ANDROID_SDK $ENV{ANDROID_SDK} CACHE STRING "")
endif()
It will check ANDROID_SDK
for EVN and set in CACHE.
If ENV is not defined then autodetection.