Problem getting SDK version from semver.from(sdk.default_build_tools_version)
xandro0777 opened this issue · 6 comments
On my Debian Bullseye this doesn't work as the value of sdk.default_build_tools_version appears to be "debian" at this point.
Have installed debian package android-sdk-platform-23, android-sdk and android-sdk-build-tools , for example aapt is /usr/lib/android-sdk/build-tools/debian/aapt - so I guess there is a problem getting the version from this.
On my Debian Bullseye this doesn't work as the value of sdk.default_build_tools_version appears to be "debian" at this point.
Have installed debian package android-sdk-platform-23, android-sdk and android-sdk-build-tools , for example aapt is /usr/lib/android-sdk/build-tools/debian/aapt - so I guess there is a problem getting the version from this.
Yes, the Android SDK is an absolute mess in this regard also - with no standards or guideline to where people can place things and how they should name stuff. I remember some other parts of vab
had this problem.
Disabling it will unfortunately break the --build-tools
option since it uses the directory names as version numbers (used by recent SDKs - that hopefully won't change any time soon) - but I can maybe add a check
@xandro0777 - can you please post the output of ./vab doctor
- this issue should have been fixed long ago?
What version of vab
are you using? Try updating vab
via git
and build it again and try again.
./vab doctor
will help us greatly since I can see how your setup looks like
Just updated v and cloned a fresh copy of vab in a separate directory and built it:
$ vab doctor
No "sdkmanager" could be detected.
You can set the SDKMANAGER env variable or try your luck with `vab install auto`.
Please see https://stackoverflow.com/a/61176718/1904615 for more help.
vab
Version 0.2.1 46d0bc6
Path "/home/rz/prog/vab"
ANDROID_HOME=/usr/lib/android-sdk
ANDROID_SDK_ROOT=/usr/lib/android-sdk
ANDROID_NDK_ROOT=/usr/lib/android-sdk/ndk-bundle
Java
JDK
Version 11.0.12
Path "/usr/lib/jvm/java-11-openjdk-i386"
Android
ENV
sdkmanager ""
sdkmanager.version "0.0.0"
Managable: false
SDK
Path "/usr/lib/android-sdk"
Writable false
NDK
Version ndk-bundle
Path "/usr/lib/android-sdk/ndk-bundle"
Side-by-side false
Build
API 23
Build-tools debian
Packaging
Format apk
Product
Name "V Test App"
Package ID "io.v.android"
Output "v_test_app.apk"
V
Version 0.2.4 83d492b
Path "/home/rz/prog/v"
OS: linux, Debian GNU/Linux 11 (bullseye)
Processor: 2 cpus, 32bit, little endian, Intel(R) Pentium(R) CPU 3560M @ 2.40GHz
CC version: cc (Debian 10.2.1-6) 10.2.1 20210110
getwd: /home/rz/prog/vab
vmodules: /home/rz/.vmodules
vroot: /home/rz/prog/v
vexe: /home/rz/prog/v/v
vexe mtime: 2021-09-06 20:48:20
is vroot writable: true
is vmodules writable: true
V full version: V 0.2.4 02d823f.83d492b
Git version: git version 2.30.2
next cloned a fresh copy of vlang/ui
$ cd ui/examples
$ vab users.v
V panic: main.validate_env:463 error converting build-tools version "debian" to semantic version.
semver: semver.InvalidVersionFormatError: Invalid version format for input "debian"
v hash: 83d492b
Further info...
$ dpkg -L android-sdk
/.
/usr
/usr/lib
/usr/lib/android-sdk
/usr/lib/android-sdk/tools
/usr/lib/android-sdk/tools/bin
/usr/lib/android-sdk/tools/proguard
/usr/lib/android-sdk/tools/proguard/bin
/usr/lib/android-sdk/tools/proguard/lib
/usr/share
/usr/share/doc
/usr/share/doc/android-sdk
/usr/share/doc/android-sdk/README.Debian
/usr/share/doc/android-sdk/changelog.gz
/usr/share/doc/android-sdk/copyright
$ cat /usr/share/doc/android-sdk/README.Debian
Versioning Scheme
=================
The versions of the SDK, the Build-tools and the Platform-tools are independent
from each other, and we track the versions in the following places:
* SDK: https://android.googlesource.com/platform/tools/buildSrc/+/gradle_${latest}/base/version.gradle
* Build-tools: https://android.googlesource.com/platform/development/+/android-${latest}/sdk/build_tools_source.prop_template
* Platform-tools: https://android.googlesource.com/platform/development/+/android-${latest}/sdk/plat_tools_source.prop_templaterz@rz-debian:~/prog/ui/examples
$ ll /usr/lib/android-sdk
total 40
drwxr-xr-x 8 root root 4096 Aug 23 01:17 .
drwxr-xr-x 136 root root 12288 Aug 31 23:30 ..
drwxr-xr-x 4 root root 4096 Aug 31 23:31 build-tools
drwxr-xr-x 2 root root 4096 May 27 23:40 licenses
drwxr-xr-x 13 root root 4096 May 26 2020 ndk-bundle
drwxr-xr-x 6 root root 4096 Aug 31 01:19 platforms
drwxr-xr-x 2 root root 4096 May 27 23:40 platform-tools
drwxr-xr-x 4 root root 4096 Aug 31 23:31 tools
@xandro0777 - it was a little more tricky than first anticipated since the filtering of unknown versions was also broken (someone forgot to assign the result of the filtering ahem 😅 ). So this was a result of several bugs.
Nice catch.
I've tried fixing it by allowing "exotic" build-tool versions in dbf8173 - they're now allowed but has the lowest priority when sorted in case there's more than one "type" of version detected.