vlang / vab

V Android Bootstrapper
MIT License
319 stars 29 forks source link

VAB cannot detect installed api. #244

Closed km19809 closed 1 year ago

km19809 commented 1 year ago

OS: OS: windows, Microsoft Windows 10 Education v19044 64-bit V version Version 0.3.2 523ccbc vab doctor No Android API levels could be detected in the SDK. If the SDK is working and writable, new platforms can be installed with: vab install "platforms;android-<API LEVEL>" You can set a custom SDK with the ANDROID_SDK_ROOT env variable Android API level "" is less than the supported level (21). A vab compatible version can be installed with vab install "platforms;android-21" vab Version 0.3.6 f1e7d65 Path "C:\Users\km198.vmodules\vab" Base files "C:\Users\km198.vmodules\vab\platforms\android" env SDKMANAGER=C:\Users\km198\AppData\Local\Android\Sdk\cmdline-tools\latest\bin\sdkmanager JAVA_HOME=C:\Program Files\Microsoft\jdk-17.0.5.8-hotspot\ Java JDK Version 17.0.5 Path "C:\Program Files\Microsoft\jdk-17.0.5.8-hotspot" Keytool "C:\Program Files\Microsoft\jdk-17.0.5.8-hotspot\bin\keytool.exe" Android ENV sdkmanager "C:\Users\km198\AppData\Local\Android\sdk\cmdline-tools\latest\bin\sdkmanager.bat" sdkmanager.version "8.0" Managable true SDK Path "C:\Users\km198\AppData\Local\Android\sdk" Writable true APIs available ['29', '28'] NDK Version 25.1.8937393 Path "C:\Users\km198\AppData\Local\Android\sdk\ndk" Side-by-side true min API level available 19 max API level available 33 arm64-v8a ['33', '32', '31', '30', '29', '28', '27', '26', '24', '23', '22', '21'] armeabi-v7a ['33', '32', '31', '30', '29', '28', '27', '26', '24', '23', '22', '21', '19'] x86 ['33', '32', '31', '30', '29', '28', '27', '26', '24', '23', '22', '21', '19'] x86_64 ['33', '32', '31', '30', '29', '28', '27', '26', '24', '23', '22', '21'] Build API Build-tools 33.0.0 Packaging Format apk Product Name "V Test App" Package ID "io.v.android" Output "" V Version 0.3.2 523ccbc Path "C:\v"

    OS: windows, Microsoft Windows 10 Education v19044 64-bit
    Processor: 8 cpus, 64bit, little endian, Intel(R) Core(TM) i7-1065G7 CPU @ 1.30GHz
    CC version: Error: exec failed (CreateProcess) with code 2: 지정된 파일을 찾을 수 없습니다.
     cmd: cc --version

    getwd: C:\v\examples\2048
    vmodules: C:\Users\km198\.vmodules
    vroot: C:\v
    vexe: C:\v\v.exe
    vexe mtime: 2022-11-17 05:31:50
    is vroot writable: true
    is vmodules writable: true
    V full version: V 0.3.2 523ccbc

    Git version: git version 2.28.0.windows.1
    Git vroot status: weekly.2022.46-8-g523ccbcb (3 commit(s) behind V master)
    .git/config present: true
    thirdparty/tcc status: thirdparty-windows-amd64 cb89a4fe

What did you do? I ran vab doctor, then vab did not detect the API level. However, vab --list-apis works, while vab run game.v --api 29 does not. What did you expect to see? No warning message. What did you see instead? No Android API levels could be detected in the SDK. If the SDK is working and writable, new platforms can be installed with: vab install "platforms;android-<API LEVEL>" You can set a custom SDK with the ANDROID_SDK_ROOT env variable Android API level "" is less than the supported level (21). A vab compatible version can be installed with vab install "platforms;android-21"

larpon commented 1 year ago

That is indeed a little odd 🤔

Can you try and see if vab --api 29 run game.v makes a difference (switching the flag order).

JalonSolov commented 1 year ago

If vab works like V, then yes, the options have to come before run. Options after run are passed to the executable that is built.

larpon commented 1 year ago

If vab works like V, then yes, the options have to come before run. Options after run are passed to the executable that is built.

It's not 100% like V because vab still uses flag_parser and thus also the -- prefix for long style flags but I remember having coded it as close to V's behavior as possible 👍🏻

km19809 commented 1 year ago

The position of --api does not matters. I tried vab --api 29 run 2048.v, but the result were the same. I eventually built the app by setting ANDROID_SDK_ROOT manually, but the issue is not resolved yet.

larpon commented 1 year ago

Do you have the SDK installed in more than one place?

Can you please try and compile vab with v -d debug_sdk C:\Users\km198\.vmodules\vab and then (assuming it's in your PATH) run the same command: vab --api 29 run 2048.v and paste the results 1:1 here

km19809 commented 1 year ago

vab.android.sdk.root Warning: "" is not a dir vab.android.sdk.root found SDK in hardcoded paths at "C:\Users\km198\AppData\Local\Android\sdk" No Android API levels could be detected in the SDK. If the SDK is working and writable, new platforms can be installed with: vab install "platforms;android-<API LEVEL>" You can set a custom SDK with the ANDROID_SDK_ROOT env variable

larpon commented 1 year ago

That is super odd :thinking:

You never answered if you have more than one SDK installed?

What is the contents of your ANDROID_SDK_ROOT env variable, when vab works?

Can you paste a screenshot or a dir listing of the contents of C:\Users\km198\AppData\Local\Android\sdk

Also in your doctor output the SDKMANAGER lives in C:\Users\km198\AppData\Local\Android\Sdk but everything else is in C:\Users\km198\AppData\Local\Android\sdk (note the uppercase "S" in Sdk vs. sdk) this is a very odd setup.

JalonSolov commented 1 year ago

Windows is "case-preserving", not "case-sensitive". Uppercase vs lowercase doesn't matter in paths.

km19809 commented 1 year ago

You never answered if you have more than one SDK installed?

  1. That's my fault. I forgot about the question. I did not install any SDK manually, except for C:\Users\km198\AppData\Local\Android\Sdk. What is the contents of your ANDROID_SDK_ROOT env variable, when vab works?

Same as above, "C:\Users\km198\AppData\Local\Android\Sdk". Can you paste a screenshot or a dir listing of the contents of C:\Users\km198\AppData\Local\Android\sdk

image

Also, as @JalonSolov said, The windows OS is case-insensitive. Both Sdk and sdk are the same.

larpon commented 1 year ago

Thanks,

Another question; the contents of C:\Users\km198\AppData\Local\Android\Sdk\platforms would also be helpful :slightly_smiling_face:

km19809 commented 1 year ago

Sorry, I missed the notification. image Here are the contents of C:\Users\km198\AppData\Local\Android\Sdk\platforms. There are only two directories, android-28 and android-29

larpon commented 1 year ago

Potential fix in #248, you can re-open this issue if it doesn't work for you.

km19809 commented 1 year ago

It fixed! Thank you.