GithubHelp home page GithubHelp logo

vlang / vab Goto Github PK

View Code? Open in Web Editor NEW
306.0 28.0 30.0 1.36 MB

V Android Bootstrapper

License: MIT License

V 99.41% AMPL 0.05% Java 0.16% Verilog 0.38%
v vlang android bootstrap compiler java sdk ndk apk aab

vab's Introduction

V Android Bootstrapper

HomeDocsFAQ

V Android Bootstrapper is the currently supported way to compile, package, sign and deploy V graphical apps on Android based devices. It can be used as a V module (import vab) and also provides a standalone executable (vab) for building apps from the command-line.

Install

Linux, macOS and Windows build hosts are supported.

Unix (Linux, macOS)

v install vab
v ~/.vmodules/vab

Windows

v install vab
v %USERPROFILE%\.vmodules\vab

Symlink (optional)

You can symlink vab to your $PATH so it works as a global shell command.

sudo ln -s /path/to/vab /usr/local/bin/vab

Shell tab completion (optional)

You can install tab completions for your shell by following the instructions here.

Usage

vab can be used both from the command line and as a module in V code. In either case the following dependencies is required before vab will work as intented.

Dependencies:

  • V
  • Java (JDK) >= 8 (>= 9 on Windows)
  • Android SDK
  • Android NDK

(Android Studio is NOT required)

If vab fail to detect your environment you can set ENV variables to help it:

JAVA_HOME=/path/to/java-jdk
SDKMANAGER=/path/to/sdkmanager
ANDROID_SDK_ROOT=/path/to/android_sdk_linux
ANDROID_NDK_ROOT=/path/to/android_ndk_linux
VEXE=/path/to/custom/v/binary

Development (debug builds)

The fast way from V source to an APK is:

vab /path/to/v/source/file/or/dir

... yes, that's it. Your APK should now reside in the current directory.

The fast way from source to a run on the device (build, package, deploy and launch app on device) is:

vab run --device auto --archs 'armeabi-v7a' /path/to/v/source/file/or/dir

The --archs flag control what architectures your app is built for. You can specify multiple archs with --archs 'armeabi-v7a, arm64-v8a'. By default vab will build for all 4 supported CPU architectures (arm64-v8a, armeabi-v7a, x86 and x86_64).

Release

You can build an Android app ready for the Play Store with the following command:

export KEYSTORE_PASSWORD="pass"
export KEYSTORE_ALIAS_PASSWORD="word"
vab -prod --name "V App" --package-id "com.example.app.id" --icon /path/to/file.png  --version-code <int> --keystore /path/to/sign.keystore --keystore-alias "example" /path/to/v/source/file/or/dir

Do not submit apps using default values. Please make sure to adhere to all guidelines of the app store you're publishing to.

AAB package format

vab supports outputting Android App Bundles (AAB). To output an .aab file you can specify the package format with the --package flag:

vab --package aab /path/to/v/source/file/or/dir

Alternatively it will be inferred if you use the --output/-o flag:

vab -o /tmp/ma_app.aab /path/to/v/source/file/or/dir

Environment variables

If vab should fail to detect a tool or location on your build host you can use the following ENV variables to help vab understand your Android development setup.

Complete list of env variables recognized

VEXE                     # Absolute path to the V executable to use
JAVA_HOME                # Absolute path to the Java install to use
SDKMANAGER               # Absolute path to the sdkmanager to use
ANDROID_SERIAL           # ID of the device to deploy to
ANDROID_SDK_ROOT         # Absolute path to the Android SDK
ANDROID_NDK_ROOT         # Absolute path to the Android NDK
KEYSTORE_PASSWORD        # Password for keystore
KEYSTORE_ALIAS_PASSWORD  # Password for keystore alias
BUNDLETOOL               # Absolute path to the bundletool to use
AAPT2                    # Absolute path to the aapt2 to use
ADB                      # Absolute path to the adb to use
VAB_FLAGS                # Use to pass flags to vab. Command-line flags overwrites any flags/values set via VAB_FLAGS.
VAB_KILL_ADB             # Set to let vab kill adb after use. This is useful on some hosts.

VAB_FLAGS example:

VAB_FLAGS="-v 3 --name 'V App' --api 30 --build-tools 29.0.0" vab /path/to/v/source/file/or/dir

See all options:

vab -h

Setup

vab has support for downloading it's dependencies automatically, except the Java JDK.

If you have nerves to let it try and figure things out automatically simply do: vab install auto

Java

Windows

OpenJDK can be installed via https://adoptium.net/.

macOS

Installing Java JDK using homebrew

brew tap adoptopenjdk/openjdk
brew cask install adoptopenjdk

Linux

You should be able to find a way to install Java JDK >= 8 with your package manager of choice.

sudo apt install openjdk-<version>-jdk

E.g.: sudo apt install openjdk-8-jdk

termux (experimental)

NOTE Currently only tested for arm64 on Android 9 and above.

You must install Java 17 and few more things:

pkg install openjdk-17 aapt apksigner dx ecj

Download, unzip and set enviroment variables to the SDK and NDK from:

https://github.com/Lzhiyong/termux-ndk/releases.

You may have to set the SDK version to be compatible with the NDK (sdkmanager install/uninstall platform-version).

Enjoy using vab on termux!

@MatejMagat305 has made a video of the process you can watch here:

https://www.youtube.com/watch?v=7aUh39w_-2Q.

The accompaning script used in the video can be found here:

https://github.com/MatejMagat305/vab-termux.

Notes

vab targets as low an API level as possible by default for maximum compatibility, you can however tell it to target newer Android versions by using the --api flag. Example: vab --api 30 <...>.

Installed API levels can be listed with vab --list-apis.

Troubleshooting

Android is a complex ecosystem that has differences between build hosts and tool versions - please consult our FAQ for answers to frequently asked questions.

vab's People

Contributors

artemkakun avatar delta456 avatar elimisteve avatar gladear avatar hungrybluedev avatar itsdonnix avatar km19809 avatar larpon avatar matejmagat305 avatar medvednikov avatar sheatnoisette avatar spaceface777 avatar spytheman avatar timbasel avatar ttytm avatar yuyi98 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

vab's Issues

Vab can't install Android API level

Ubuntu 20.10 x64
V full version: V 0.2.2 5306b27
vab version 0.2.1 9c93ea8

What did you do?
Run ./vab install "platforms;android-30"

What did you expect to see?
Android API level 30 to be installed.

What did you see instead?

Warning: Failed to find package android-30                                      
[===                                    ] 10% Computing updates...     

I have a working internet through which I installed the Android NDK.

`vab` doesn't support traget API > 31

When I set up --api to 33, vab still uses 31 and fails

      - name: Setup Android SDK
        uses: amyu/setup-android@v2
        with:
          sdk-version: 33
          build-tools-version: '33.0.2'
          ndk-version: '23.1.7779620'
          cache-disabled: true

      ...

      - name: Build APK
        run: vab --api 33 --archs 'arm64-v8a' -v 3 .
| Replacing minimum SDK version "21" with "21"
| Replacing target SDK version "21" with "31"
| Replacing declaration of OpenGL ES version "0x00020000" with "0x00020000"
| Replacing activity name "io.v.android.VActivity" with "io.v.android.VActivity"
| Copying assets
| Running aapt From: /home/yuart/Projects/v-project-basement
| /root/.android/sdk/build-tools/33.0.2/aapt package -v -f -m -M "/tmp/vab/package/apk/AndroidManifest.xml" -S "/tmp/vab/package/apk/res" -J "/tmp/vab/package/apk/src" -A "/tmp/vab/package/apk/assets" -I "/root/.android/sdk/platforms/android-31/android.jar"
| Packaging didn't succeed.
| /root/.android/sdk/build-tools/33.0.2/aapt package -v -f -m -M "/tmp/vab/package/apk/AndroidManifest.xml" -S "/tmp/vab/package/apk/res" -J "/tmp/vab/package/apk/src" -A "/tmp/vab/package/apk/assets" -I "/root/.android/sdk/platforms/android-31/android.jar" failed with return code 1:
| asset W 02-26 20:10:16  1238  1238] Asset path /root/.android/sdk/platforms/android-31/android.jar is neither a directory nor file (type=1).
| ERROR: Asset package include '/root/.android/sdk/platforms/android-31/android.jar' not found.
| Found 0 custom asset files in /tmp/vab/package/apk/assets
| Configurations:
|  (default)
|
| Files:
|   mipmap/icon.png
|     Src: () /tmp/vab/package/apk/res/mipmap/icon.png
|   values/strings.xml
|     Src: () /tmp/vab/package/apk/res/values/strings.xml
|   AndroidManifest.xml
|     Src: () /tmp/vab/package/apk/AndroidManifest.xml
|
| Resource Dirs:
|   Type mipmap
|     mipmap/icon.png
|       Src: () /tmp/vab/package/apk/res/mipmap/icon.png
|   Type values
|     values/strings.xml
|       Src: () /tmp/vab/package/apk/res/values/strings.xml
| Including resources from package: /root/.android/sdk/platforms/android-31/android.jar

V panic: converting jdk_version "9" to semantic version.

To make the current code for my macos install working, I simply commented this lines in vab.v:

        // jdk_semantic_version := semver.from(jdk_version) or {
	// 	panic(@MOD + '.' + @FN + ':' + @LINE +
	// 		' error converting jdk_version "$jdk_version" to semantic version.\nsemver: ' + err)
	// }
	// if !jdk_semantic_version.ge(semver.build(1, 8, 0)) { // NOTE When did this break:.satisfies('1.8.*') ???
	// 	// Some Android tools like `sdkmanager` in cmdline-tools;1.0 only worked with Java 8 JDK (1.8.x).
	// 	// (Absolute mess, yes)
	// 	eprintln('Java JDK version $jdk_version is not supported')
	// 	eprintln('Please install Java >= 8 JDK or provide a valid path via JAVA_HOME')
	// 	exit(1)
	// }

Otherwise, it generates the panic error:
V panic: main.validate_env:393 error converting jdk_version "9" to semantic version.

vab doctor --api 29
vab
	Version 0.2.1 a16801a

	Path "/Users/rcqls/vlang/vab"
Java
	JDK
		Version 9
		Path "/Library/Java/JavaVirtualMachines/adoptopenjdk-9.jdk/Contents/Home"
Android
	ENV
		sdkmanager "/Users/rcqls/.cache/v/android/cmdline-tools/tools/bin/sdkmanager"
		sdkmanager.version "4.0.1"
		Managable: true
	SDK
		Path "/Users/rcqls/Library/Android/sdk"
		Writable true
	NDK
		Version 22.0.7026061
		Path "/Users/rcqls/Library/Android/sdk/ndk"
		Side-by-side true
	Build
		API 29
		Build-tools 30.0.3
Product
	Name "V Test App"
	Package "io.v.android"
	Output "v_test_app.apk"
V
	Version 0.2.2 db0fc8f
	Path "/Users/rcqls/vlang/v"

	OS: macos, macOS, 11.1, 20C69
	Processor: 4 cpus, 64bit, little endian, Intel(R) Core(TM) m7-6Y75 CPU @ 1.20GHz
	CC version: Apple clang version 12.0.0 (clang-1200.0.32.29)

	getwd: /Users/rcqls/vlang/apk
	vmodules: /Users/rcqls/.vmodules
	vroot: /Users/rcqls/vlang/v
	vexe: /Users/rcqls/vlang/v/v
	vexe mtime: 2021-02-06 21:04:32
	is vroot writable: true
	is vmodules writable: true
	V full version: V 0.2.2 db0fc8f

	Git version: git version 2.30.0
	Git vroot status: weekly.2021.5-115-gdb0fc8fb-dirty (2 commit(s) behind V master)
	.git/config present: true
	thirdparty/tcc status: thirdparty-macos-amd64 689c8a02

V panic: main.validate_env:455 error converting build-tools version "" to semantic version.

Cannot run example with vab run --api 21 --build-tools 30.0.2 ~/src/v/examples/sokol/particles.

V panic: main.validate_env:455 error converting build-tools version "" to semantic version.
semver: Empty input
/tmp/v/vab.1353969781524914859.tmp.c:8040: at v_panic: Backtrace
/tmp/v/vab.1353969781524914859.tmp.c:24638: by main__validate_env
/tmp/v/vab.1353969781524914859.tmp.c:24446: by main__main
/tmp/v/vab.1353969781524914859.tmp.c:25174: by main

vab doctor

Android API level "" is not available in SDK.
It can be installed with `vab install "platforms;android-<API LEVEL>"`
Android API level "" is less than the supported level (21).
A vab compatible version can be installed with `vab install "platforms;android-21"`
Android build-tools version  is not available in SDK.
(A vab compatible version can be installed with `vab install "build-tools;24.0.3"`)
vab
	Version 0.2.1 e71a4d8

	Path "/home/erich/src/vab"
Java
	JDK
		Version 15.0.0
		Path "/usr/lib/jvm/java-15-openjdk-amd64"
Android
	ENV
		sdkmanager "/home/erich/src/android-tools/cmdline-tools/latest/bin/sdkmanager"
		sdkmanager.version "Picked up _JAVA_OPTIONS: -Dawt.useSystemAAFontSettings=on -Dswing.aatext=true
3.0"
		Managable: true
	SDK
		Path "/home/erich/Android/Sdk"
		Writable true
	NDK
		Version 21.1.6352462
		Path "/home/erich/Android/Sdk/ndk"
		Side-by-side true
	Build
		API
		Build-tools
	Packaging
		Format apk
Product
	Name "V Test App"
	Package ID "io.v.android"
	Output "v_test_app.apk"
V
	Version 0.2.2 1a8ff9d
	Path "/home/erich/src/v"

	OS: linux, Pop!_OS 20.10
	Processor: 4 cpus, 64bit, little endian, AMD FX(tm)-4100 Quad-Core Processor
	CC version: cc (Ubuntu 10.2.0-13ubuntu1) 10.2.0
	
	getwd: /home/erich
	vmodules: /home/erich/.vmodules
	vroot: /home/erich/src/v
	vexe: /home/erich/src/v/v
	vexe mtime: 2021-02-26 11:37:09
	is vroot writable: true
	is vmodules writable: true
	V full version: V 0.2.2 1a8ff9d
	
	Git version: git version 2.27.0
	Git vroot status: weekly.2021.8-74-g1a8ff9d7
	.git/config present: true
	thirdparty/tcc status: thirdparty-linux-amd64 7543de81

`--api` flag is not enough

I want to control both minimum and target APIs.

In my opinion, we should have 2 flags: --minimum-api and --target-api

build error: bad module difinition

OS: ArchLinux

V version: 0.2.2 a73c209

vab doctor

What did you do?
~/.vmodules/vab% v vab.v
What did you expect to see?

What did you see instead?

builder error: bad module definition: vab.v imports module "vxt" but /home/tsukasa/.vmodules/vab/vxt/vxt.v is defined as module `vab.vxt`

Can't find keytool

OS:
Windows 10 Pro 64bit

V version

vab doctor

C:\Users\mlap\Downloads\temp>vab doctor
Warning: could not locate keytool: vab.java.jdk_keytool: no keytool.exe could be located in "C:\Program Files\Common Files\Oracle\Java\javapath_target_1556046"
vab will not be able to sign any packages.
It looks like you have a Java compiler (C:\Program Files\Common Files\Oracle\Java\javapath_target_1556046\javac.exe) but no keytool
you probably have Java JRE installed but no JDK.
Please install Java JDK >= 8 or provide a valid path via JAVA_HOME
The detected sdkmanager seems outdated or incompatible with the Java version used.
For vab to control it's own dependencies, please update sdkmanager found in:
"C:\Users\mlap\AppData\Local\Android\sdk\tools\bin\sdkmanager.bat"
or use a Java version that is compatible with your sdkmanager.
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.3.7 fff2efd
Path "C:\Users\mlap.vmodules\vab"
Base files "C:\Users\mlap.vmodules\vab\platforms\android"
env
JAVA_HOME=C:\Program Files\Java\jdk-19
Java
JDK
Version 19.0.0
Path "C:\Program Files\Java\jdk-19"
Keytool "N/A"
Android
ENV
sdkmanager "C:\Users\mlap\AppData\Local\Android\sdk\tools\bin\sdkmanager.bat"
sdkmanager.version "0.0.0"
Managable false
SDK
Path "C:\Users\mlap\AppData\Local\Android\sdk"
Writable true
APIs available ['33', '31', '25']
NDK
Version 25.2.9519653
Path "C:\Users\mlap\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 33
Build-tools 33.0.1
Packaging
Format apk
Product
Name "V Test App"
Package ID "io.v.android"
Output ""
V
Version 0.3.3 6e1e406
Path "C:\v"

    V full version: V 0.3.3 6e670ec.6e1e406
    OS: windows, Microsoft Windows 10 Pro v19045 64-bit
    Processor: 4 cpus, 64bit, little endian,

    getwd: C:\Users\mlap\Downloads\temp
    vexe: C:\v\v.exe
    vexe mtime: 2023-03-17 13:09:22

    vroot: OK, value: C:\v
    VMODULES: OK, value: C:\Users\mlap\.vmodules
    VTMP: OK, value: C:\Users\mlap\AppData\Local\Temp\v_0

    Git version: git version 2.37.3.windows.1
    Git vroot status: weekly.2023.11-18-g6e1e4062 (21 commit(s) behind V master)
    .git/config present: true

    CC version: Error: exec failed (CreateProcess) with code 2: The system cannot find the file specified.
     cmd: cc --version
    thirdparty/tcc status: thirdparty-windows-amd64 1e6e7c6f

What did you do?

C:\Users\mlap\Downloads\temp>vab .

I try to make apk from .v file, but error is returned.

What did you expect to see?

Successfully generated apk.

What did you see instead?

Warning: could not locate keytool: vab.java.jdk_keytool: no keytool.exe could be located in "C:\Program Files\Common Files\Oracle\Java\javapath_target_1556046"
vab will not be able to sign any packages.
It looks like you have a Java compiler (C:\Program Files\Common Files\Oracle\Java\javapath_target_1556046\javac.exe) but no keytool
you probably have Java JRE installed but no JDK.
Please install Java JDK >= 8 or provide a valid path via JAVA_HOME

I really have Java JRE 8 in "C:\Program Files\Common Files\Oracle\Java\javapath_target_1556046", but I have full new Java JDK in JAVA_HOME, detected from vab doctor (see above).

VAB does not detect `adb`

OS:
OS: windows, Microsoft Windows 10 Education v19044 64-bit
V version
V 0.3.2 cbe64cb
vab doctor

vab.android.sdk.root found SDK in hardcoded paths at "C:\Users\km198\AppData\Local\Android\sdk"
vab
        Version 0.3.7 7bd2bc2
        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 29
                Build-tools 33.0.0
        Packaging
                Format apk
Product
        Name "V Test App"
        Package ID "io.v.android"
        Output ""
V
        Version 0.3.2 cbe64cb
        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\flappylearning
        vmodules: C:\Users\km198\.vmodules
        vroot: C:\v
        vexe: C:\v\v.exe
        vexe mtime: 2022-12-01 23:31:05
        is vroot writable: true
        is vmodules writable: true
        V full version: V 0.3.2 cbe64cb

        Git version: git version 2.28.0.windows.1
        Git vroot status: weekly.2022.47-32-gcbe64cb5-dirty
        .git/config present: true
        thirdparty/tcc status: thirdparty-windows-amd64 cb89a4fe

What did you do?
I ran C:\Users\km198\.vmodules\vab\vab --api 28 --log --device auto -v -v run game.v
What did you expect to see?
It should detect adb as usual and run the app in the emulator.
What did you see instead?

vab.android.sdk.root found SDK in hardcoded paths at "C:\Users\km198\AppData\Local\Android\sdk"
Notice: Android API level 28 is less than the default level (29).
Compiling V to C
Compiling V import C dependencies (.c to .o for ['arm64-v8a', 'armeabi-v7a', 'x86', 'x86_64']) in parallel
Compiling C output for ['arm64-v8a', 'armeabi-v7a', 'x86', 'x86_64'] in parallel
Preparing package "io.v.android"...
Removing previous package directory "C:\Users\km198\AppData\Local\Temp\vab\package\apk"
Copying base files from "C:\Users\km198\.vmodules\vab\platforms\android" to "C:\Users\km198\AppData\Local\Temp\vab\package\apk"
Modifying base files
Copying assets
Including assets from ".\assets"
Including assets from "C:\v\examples\assets"
vab deployment didn't succeed.
vab.android.deploy_apk: Couldn't locate "adb". Please make sure it's installed.

Additional Information
My adb is located at: C:\Users\km198\AppData\Local\Android\Sdk\platform-tools
image

If I set the ADB environment variable,
vab detects the variable:

env
        SDKMANAGER=C:\Users\km198\AppData\Local\Android\Sdk\cmdline-tools\latest\bin\sdkmanager
        ADB=C:\Users\km198\AppData\Local\Android\Sdk\platform-tools\adb
        JAVA_HOME=C:\Program Files\Microsoft\jdk-17.0.5.8-hotspot\

but not the executable:
image

So I set the variable with the file extension:
image
It successfully detects and runs the app.

This is weird because neither cmd.exe nor PowerShell require .exe to run the executable.

Finding sdkmanager error

Corrected issue; user error. Configuration mistake with not putting proper env line. Corrected by adding "\sdkmanager" to ending.
SDKMANAGER=path\cmdline-tools\lastest\bin\sdkmanager

Error message received:

vab doctor
The detected `sdkmanager` seems outdated or incompatible with the Java version used.
For `vab` to control it's own dependencies, please update `sdkmanager` found in:
"path\cmdline-tools\latest\bin" or use a Java version that is compatible with your `sdkmanager`.
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.

May also see- sdkmanager.version "0.0.0"

An example works weirdly.

OS:
linux, Ubuntu 20.04.5 LTS (WSL 2)
V version
Version 0.3.2 5f33585
vab doctor
vab
Version 0.3.6 166bd68
Path "/home/minsoo/.vmodules/vab"
Base files "/home/minsoo/.vmodules/vab/platforms/android"
env
ANDROID_SDK_ROOT=/home/minsoo/android_sdk
SDKMANAGER=/home/minsoo/android_sdk/cmdline-tools/latest/bin/sdkmanager
JAVA_HOME=/usr/lib/jvm/java-11-openjdk-amd64
Java
JDK
Version 11.0.16
Path "/usr/lib/jvm/java-11-openjdk-amd64"
Keytool "/usr/lib/jvm/java-11-openjdk-amd64/bin/keytool"
Android
ENV
sdkmanager "/home/minsoo/android_sdk/cmdline-tools/latest/bin/sdkmanager"
sdkmanager.version "7.0"
Managable true
SDK
Path "/home/minsoo/android_sdk"
Writable true
APIs available ['29']
NDK
Version 22.1.7171670
Path "/home/minsoo/android_sdk/ndk-bundle"
Side-by-side false
min API level available 16
max API level available 30
arm64-v8a ['30', '29', '28', '27', '26', '24', '23', '22', '21']
armeabi-v7a ['30', '29', '28', '27', '26', '24', '23', '22', '21', '19', '18', '17', '16']
x86 ['30', '29', '28', '27', '26', '24', '23', '22', '21', '19', '18', '17', '16']
x86_64 ['30', '29', '28', '27', '26', '24', '23', '22', '21']
Build
API 29
Build-tools 26.0.2
Packaging
Format apk
Bundletool "/home/minsoo/.cache/v/android/bundletool.jar"
Product
Name "V Test App"
Package ID "io.v.android"
Output ""
V
Version 0.3.2 5f33585
Path "/home/minsoo/v"

    OS: linux, Ubuntu 20.04.5 LTS (WSL 2)
    Processor: 8 cpus, 64bit, little endian, Intel(R) Core(TM) i7-9700K CPU @ 3.60GHz
    CC version: cc (Ubuntu 9.4.0-1ubuntu1~20.04.1) 9.4.0

    getwd: /home/minsoo/v/examples/flappylearning
    vmodules: /home/minsoo/.vmodules
    vroot: /home/minsoo/v
    vexe: /home/minsoo/v/v
    vexe mtime: 2022-11-08 02:44:00
    is vroot writable: true
    is vmodules writable: true
    V full version: V 0.3.2 5f33585

    Git version: git version 2.25.1
    Git vroot status: 0.3.2-70-g5f33585e-dirty
    .git/config present: true
    thirdparty/tcc status: thirdparty-linux-amd64 12f392c3

What did you do?
I built a flappylearning example.
The command that I used is:
vab --name "FlappyLearning" --icon "assets/img/bird.png" game.v
I ran it on my android device, running on android 12.
What did you expect to see?
I should see, something similar to the desktop version.
image

What did you see instead?
I got a blank, white background.
image

I suspect the behavior of os.read_apk_asset, but I have no clue.
I don't even know if it is a vab issue, because I failed to launch the adb on WSL2.

seems missing mbedtls android lib?

hello, I try to build a v example file which using http request into apk, but on android, logcat show below error message.

"04-11 18:09:37.357 26605 26605 E AndroidRuntime: java.lang.UnsatisfiedLinkError: dlopen failed: cannot locate symbol "mbedtls_entropy_func" referenced by "/data/app/io.v.android-ihK8P-u8HB98ZcUZ9wgnCw==/lib/arm64/libv_test_app.so"...

does it mean that start that apk, it try to loading mbedtls library, but it couldn't find it?

how should I include maybe the "static mbedtls library" in to apk to avid this error? or any other suggestion? thank you.

Specify more details in README

Exciting project!

Questions it'd be great to answer some place, either here or in the README:

  1. Can we do network calls from V in an Android app generated with vab? Last I heard there are extra hoops one must jump through to use the network on Android from a language other than Java or Kotlin, though that was 3 years ago.

  2. Are there any apps in the Play Store right now that were written in V? If so, consider linking to them!

  3. What limitations should we expect right now?

  4. Has anyone built the UI and glue code in Kotlin, and built the rest of the app in V?

Thanks!

Problem getting SDK version from semver.from(sdk.default_build_tools_version)

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.

V panic: Invalid version format

Hi, i'm getting this error when i run app.
Command: ./vab run --device auto --archs 'armeabi-v7a' counter.v

Error:

V panic: Invalid version format
0   vab                                 0x000000010c77f520 main__validate_env + 320
1   vab                                 0x000000010c77d698 main__main + 6568
2   vab                                 0x000000010c78212e main + 78
3   vab                                 0x000000010c717cb4 start + 52
4   ???                                 0x0000000000000007 0x0 + 7

Vab Doctor:

➜  vab git:(master) ✗ ./vab doctor
vab
	Version 0.2.0
	Path "/Users/yusufusta/Desktop/vab"
V
	Version 0.2
	Path "/usr/local/Cellar/vlang/0.2/libexec"
Java
	JDK
		Version 13
		Path "/System/Library/Frameworks/JavaVM.framework/Versions/A"
	Android
		SDK
			Path "/Users/yusufusta/Library/Android/sdk"
			Tool.sdkmanager "/Users/yusufusta/Library/Android/sdk/tools/bin/sdkmanager"
			Writable true
		NDK
			Version 22.0.7026061
			Path "/Users/yusufusta/Library/Android/sdk/ndk"
			Side-by-side true
		Build
			API 29
			Build-tools 29.0.2
Product
	Name "V Test App"
	Package "org.v.android.test.app"
	Output "v_test_app.apk"

V version:

➜  vab git:(master) ✗ v -v
V 0.2 e4f94b6

failed to compile .c to .o

When source file imports net or vweb module, compiling didn't succeed.
Is it possible to support these modules?

vab.android.CompileError: failed to compile .c to .o: /Users/weiwang/Downloads/ndk/21.3.6528147/toolchains/llvm/prebuilt/darwin-x86_64/bin/aarch64-linux-android21-clang failed with return code 1

Keyboard ?

Wondering if it is possible to invoke the android keyboard?

What is wrong?

OS:
linux, Kali GNU/Linux Rolling

V version
Version 0.3.3 d1f57ea

vab doctor

vab
        Version 0.3.7 
        Path "/usr/local/bin"
        Base files "/home/matejmag/.vmodules/vab/platforms/android"
env
        ANDROID_HOME=/home/matejmag/Android/Sdk
        JAVA_HOME=/usr/lib/jvm/java-1.8.0-openjdk-amd64
Java
        JDK
                Version 1.8.0
                Path "/usr/lib/jvm/java-1.8.0-openjdk-amd64"
                Keytool "/usr/lib/jvm/java-17-openjdk-amd64/bin/keytool"
Android
        ENV
                sdkmanager "/home/matejmag/Android/Sdk/tools/bin/sdkmanager"
                sdkmanager.version "26.1.1"
                Managable true
        SDK
                Path "/home/matejmag/Android/Sdk"
                Writable true
                APIs available ['33', '32', '31', '30', '29', '28', '27', '26', '25', '24', '23', '22', '21']
        NDK
                Version 25.1.8937393
                Path "/home/matejmag/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 33
                Build-tools 33.0.1
        Packaging
                Format apk
Product
        Name "V Test App"
        Package ID "io.v.android"
        Output ""
V
        Version 0.3.3 d1f57ea
        Path "/home/matejmag/Documents/v"

        OS: linux, Kali GNU/Linux Rolling
        Processor: 32 cpus, 64bit, little endian, AMD Ryzen 9 5950X 16-Core Processor
        CC version: cc (Debian 12.2.0-13) 12.2.0

        getwd: /home/matejmag/Documents/v/examples
        vmodules: /home/matejmag/.vmodules
        vroot: /home/matejmag/Documents/v
        vexe: /home/matejmag/Documents/v/v
        vexe mtime: 2023-01-30 18:24:19
        is vroot writable: true
        is vmodules writable: true
        V full version: V 0.3.3 1d4fd53.d1f57ea

        Git version: git version 2.39.0
        Git vroot status: 0.3.3-dirty
        .git/config present: true
        thirdparty/tcc status: thirdparty-linux-amd64 12f392c3

What did you do?
vab /home/matejmag/Documents/v/examples/2048 -o b.apk

What did you expect to see?
compile

What did you see instead?

Packaging didn't succeed.
vab.android.package_apk: could not remove "/tmp/vab/libs":
Directory not empty

Failed to remove: No such file or directory

OS:
windows, Microsoft Windows 11 Home Single Language v22621 64-bit

V version
0.3.3 d7a418f

vab version
0.3.7 fff2efd

What did you do?
vab run --device auto snek

What did you expect to see?
the snek game running on my android device

What did you see instead?

Notice: Falling back to API level "30" (SDK API level 33 > highest NDK API level 30).
Notice: Android API level 30 is less than the default level (33).
V panic: Failed to remove "C:\Users\me\AppData\Local\Temp\vab\package\apk\assets\fonts": No such file or directory
v hash: 7de3485
C:/Users/me/AppData/Local/Temp/v_0/vab.2319595620471669553.tmp.c:13751: at _v_panic: Backtrace
C:/Users/me/AppData/Local/Temp/v_0/vab.2319595620471669553.tmp.c:45043: by vab__android__prepare_base
C:/Users/me/AppData/Local/Temp/v_0/vab.2319595620471669553.tmp.c:43681: by vab__android__package_apk
C:/Users/me/AppData/Local/Temp/v_0/vab.2319595620471669553.tmp.c:43596: by vab__android__package
C:/Users/me/AppData/Local/Temp/v_0/vab.2319595620471669553.tmp.c:46620: by main__main
C:/Users/me/AppData/Local/Temp/v_0/vab.2319595620471669553.tmp.c:47572: by wmain
00625d48 : by ???
00625eab : by ???
7ffedd0c26bd : by ???

NDK version

NDK 22 and above do not have this sysroot path
-I "Android/Sdk/ndk/23.0.7599858/sysroot/usr/include/"

Windows does not have an unzip tool for auto-installation (?)

OS:

  • Windows 10 (1909)

V version

  • V 0.2.2 92f19f5

vab doctor

V panic: string index out of range: 1 / 1
C:/Users/koplenov/AppData/Local/Temp/v/vab.1399224875655115396.tmp.c:8587: at v_panic: Backtrace
C:/Users/koplenov/AppData/Local/Temp/v/vab.1399224875655115396.tmp.c:11725: by string_at
C:/Users/koplenov/AppData/Local/Temp/v/vab.1399224875655115396.tmp.c:13358: by os__is_abs_path
C:/Users/koplenov/AppData/Local/Temp/v/vab.1399224875655115396.tmp.c:13318: by os__find_abs_path_of_executable
C:/Users/koplenov/AppData/Local/Temp/v/vab.1399224875655115396.tmp.c:22038: by vxt__vexe
C:/Users/koplenov/AppData/Local/Temp/v/vab.1399224875655115396.tmp.c:29175: by main__check_essentials
C:/Users/koplenov/AppData/Local/Temp/v/vab.1399224875655115396.tmp.c:29019: by main__main
C:/Users/koplenov/AppData/Local/Temp/v/vab.1399224875655115396.tmp.c:29845: by wmain
004f3a38 : by ???
004f3b9b : by ???
7ffddf237c24 : by ???

What did you do?

vab install auto

What did you expect to see?
Auto install complete :))

What did you see instead?

C:\DevSource\vab>vab.exe install auto
unzip failed with return code 2
exec failed (CreateProcess) with code 2: Cannot find the specified file.
 cmd: unzip C:\Users\koplenov\AppData\Local\Temp\v-android-sdk-cmdltools.tmp.zip -d C:\Users\koplenov\.cache\v\android\sdk\cmdline-tools

Is it because there was no provision for auto-installation on Windows systems?
I have no 'unzip' tool :D

Modularization support of native libs to get AAB suitable for "instant apps"

I wonder whether vab strives to support splitting the app into (potentially many) pieces of independent "bundle parts" (Android App Bundle "features" aka "modules") as described in https://medium.com/androiddevelopers/a-patchwork-plaid-monolith-to-modularized-app-60235d9f212e to achieve the "instant apps" functionality incl. so called "dynamic features" (i.e. basically views downloaded later on demand).

See https://www.youtube.com/watch?v=L9J2e5PYXNg for context.

And Android doc: https://developer.android.com/topic/google-play-instant/getting-started/instant-enabled-app-bundle

stdout , stderr redirection and related issues

I tried to redirect stdout+stderr to a file like this:

fn C.freopen(filename &char, mode &char, stream &C.FILE) &C.FILE
fn C.perror(message &char)

...
...

	file := C.freopen('/sdcard/v-log.txt'.str, c'w', C.stdout)
	if file == C.NULL {
		err := C.errno
		C.perror('problem reopening'.str)
		println('problem reopening: $err')
	}

	C.dup2(1, 2)

Apparently that fails with EACCES because the app doesn't have the permission. not unexpected.
However, the C.perror() message doesn't come, while the println does its job. What could be the problem?

Unable to build the 2048 example. Getting '/tmp/vab/package/apk/res' does not exist

OS: linux, Pop!_OS 21.10

V version V 0.2.4 0887b59.44ba197

vab doctor

OS: linux, Pop!_OS 21.10
Processor: 16 cpus, 64bit, little endian, AMD Ryzen 7 5800H with Radeon Graphics
CC version: cc (Ubuntu 11.2.0-7ubuntu2) 11.2.0

getwd: /home/link/v/examples/2048
vmodules: /home/link/.vmodules
vroot: /home/link/v
vexe: /home/link/v/v
vexe mtime: 2022-04-20 11:06:30
is vroot writable: true
is vmodules writable: true
V full version: V 0.2.4 0887b59.44ba197

Git version: git version 2.32.0
Git vroot status: weekly.2022.16-16-g44ba1971
.git/config present: true
thirdparty/tcc status: thirdparty-linux-amd64 eee03626

What did you do?
I tried building the 2048 example by doing vab 2048.v

What did you expect to see?
An apk in the same directory.

What did you see instead?

/home/link/Android/Sdk/build-tools/32.1.0-rc1/aapt failed with return code 1
ERROR: resource directory '/tmp/vab/package/apk/res' does not exist
Found 6 custom asset files in /tmp/vab/package/apk/assets

I'm new to V and Vab and would greatly appreciate any guidance!

Device orientation problem

If I compile for example 2048.v to android, run it and change the orientation of the device, app's scaling goes too small, too big or whatever in between.

I guess the reason is that in orientation change both the code and the device is resizing and it don't end well.

If I remove orientation activity from AndroidManifest.xml (a hint from some android chat), scale stays but at least this 2048 restarts in orientation change. Not a good feature for a game.

In my own graphical app testing, the issue is same. If I try to get screen size with gg.screen_size() to handle window size/scaling by code to screen limits, it returns zeroes and can not be done.
Context.window_size() (and gg.window_size() ) gives different values after orientation changes (even when back to same orientation).
Is there a way to handle this by vab or is it purely gg and coding issue.

add flag to print commands

I will mixure 2 issues, because first is short.

  1. well I m not sure that is already implemented, but it would be great to see which command is executing in vab.

  2. and I was put some command with vab and I wrong or it is bug:

vab ./v/examples/2048 -arch "arm64-v8a"
Error while parsing `os.args`: args_to_options: flag parser failed finalizing: flag.UnkownFlagError: Unknown flag `-arch`
Use `vab -h` to see all flags
                                                                                                                                             
vab ./v/examples/2048 --arch arm64-v8a  
Error while parsing `os.args`: args_to_options: flag parser failed finalizing: flag.UnkownFlagError: Unknown flag `--arch`
Use `vab -h` to see all flags
                                                                                                                                             
vab ./v/examples/2048 -f "-prod"   
Error while parsing `os.args`: args_to_options: flag parser failed finalizing: flag.UnkownFlagError: Unknown flag `-f`
Use `vab -h` to see all flags

and there is doctor:

vab
	Version 0.3.7 9b6635e
	Path "/home/matejmag/.vmodules/vab"
	Base files "/home/matejmag/.vmodules/vab/platforms/android"
env
Java
	JDK
		Version 17.0.6
		Path "/usr/lib/jvm/java-17-openjdk-amd64"
		Keytool "/usr/lib/jvm/java-17-openjdk-amd64/bin/keytool"
Android
	ENV
		sdkmanager "/usr/bin/sdkmanager"
		sdkmanager.version "25.2.0"
		Managable true
	SDK
		Path "/home/matejmag/Android/Sdk"
		Writable true
		APIs available ['33', '32', '31', '30', '29', '28', '27', '26', '25', '24']
	NDK
		Version 25.1.8937393
		Path "/home/matejmag/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 33
		Build-tools 33.0.1
	Packaging
		Format apk
Product
	Name "V Test App"
	Package ID "io.v.android"
	Output ""
V
	Version 0.3.3 10261c4
	Path "/home/matejmag/Documents/v"

	OS: linux, Kali GNU/Linux Rolling
	Processor: 32 cpus, 64bit, little endian, AMD Ryzen 9 5950X 16-Core Processor
	CC version: cc (Debian 12.2.0-14) 12.2.0
	
	getwd: /home/matejmag/Documents
	vmodules: /home/matejmag/.vmodules
	vroot: /home/matejmag/Documents/v
	vexe: /home/matejmag/Documents/v/v
	vexe mtime: 2023-02-04 11:37:04
	is vroot writable: true
	is vmodules writable: true
	V full version: V 0.3.3 e8ca2e6.10261c4
	
	Git version: git version 2.39.0
	Git vroot status: 0.3.3-12-g10261c42-dirty (17 commit(s) behind V master)
	.git/config present: true
	thirdparty/tcc status: thirdparty-linux-amd64 12f392c3

I can't install NDK

Log:

➜  vab git:(master) ✗ ./vab install ndk
Exception in thread "main" java.lang.NoClassDefFoundError: javax/xml/bind/annotation/XmlSchema
	at com.android.repository.api.SchemaModule$SchemaModuleVersion.<init>(SchemaModule.java:156)
	at com.android.repository.api.SchemaModule.<init>(SchemaModule.java:75)
	at com.android.sdklib.repository.AndroidSdkHandler.<clinit>(AndroidSdkHandler.java:81)
	at com.android.sdklib.tool.sdkmanager.SdkManagerCli.main(SdkManagerCli.java:73)
	at com.android.sdklib.tool.sdkmanager.SdkManagerCli.main(SdkManagerCli.java:48)
Caused by: java.lang.ClassNotFoundException: javax.xml.bind.annotation.XmlSchema
	at java.base/jdk.internal.loader.BuiltinClassLoader.loadClass(BuiltinClassLoader.java:604)
	at java.base/jdk.internal.loader.ClassLoaders$AppClassLoader.loadClass(ClassLoaders.java:178)
	at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:521)
	... 5 more

OS: macOS Mojave 10.14.6
V: 0.2 e4f94b6

Overwriting Application object or not?

I've just heard that overwriting an Application object usually leads to increased startup times of apps.

I didn't dig into vab nor other Android related code for the V ecosystem so I have no idea whether Application is even used in the V "wrapper", but I wanted to mention this together with the following interesting infos about "app launch latency" as I think V ecosystem strives to offer low-latency experience not only for developers, but also for end users.

  1. https://medium.com/androiddevelopers/testing-app-startup-performance-36169c27ee55
  2. https://medium.com/androiddevelopers/app-startup-part-1-34f57b65cacd
  3. https://medium.com/androiddevelopers/app-startup-part-2-c431e80d0df
  4. https://medium.com/bumble-tech/how-we-achieved-a-6x-reduction-of-anrs-part-2-fixing-anrs-24fedf9a973f

Speaking for myself, I'm really totally pissed off by Android's latencies everywhere. I have experince that Java allows to write low-latency SW at scale, but somehow Android doesn't meet the bar for me 😢. Hopefully V's ecosystem will raise the bar on Android.

enviroment var(s) to pass default archs, api vflags and cflags etc to vab

Those and perhaps more would be handy when quickly invoking vab in simple projects without an elaborate build system.

Vab already examines quite a few environment variables, so I think it might be best to have one more var like VAB_FLAGS that could hold all possible options specified like on command line rather than separate env vars for every possible detail. This would also make it relatively straightforward to have command line flags override the defaults in the env var.

VAB cannot detect installed api.

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"

build failure with V 0.2.4 abf3527

v doctor
OS: linux, Linux Mint 20.3
Processor: 4 cpus, 64bit, little endian, Intel(R) Core(TM) i5-5350U CPU @ 1.80GHz
CC version: cc (Ubuntu 9.4.0-1ubuntu1~20.04.1) 9.4.0

getwd: /home/kendfss/gitclone/clones/vlang/vab
vmodules: /home/kendfss/.vmodules
vroot: /home/kendfss/gitclone/clones/vlang/v
vexe: /home/kendfss/gitclone/clones/vlang/v/v
vexe mtime: 2022-06-06 19:55:09
is vroot writable: true
is vmodules writable: true
V full version: V 0.2.4 abf3527

Git version: git version 2.25.1
Git vroot status: weekly.2022.22-61-gabf35270-dirty (61 commit(s) behind V master)
.git/config present: true
thirdparty/tcc status: thirdparty-linux-amd64 eee03626
vab doctor
vab
	Version 0.3.4 02c8b63

	Path "/home/kendfss/gitclone/clones/vlang/vab"
	ANDROID_SDK_ROOT=/home/kendfss/Android/Sdk
	JAVA_HOME=/home/kendfss/sdk/android-studio/jre
Java
	JDK
		Version 11.0.12
		Path "/home/kendfss/sdk/android-studio/jre"
Android
	ENV
		sdkmanager "/home/kendfss/Android/Sdk/cmdline-tools/latest/bin/sdkmanager"
		sdkmanager.version "7.0"
		Managable: true
	SDK
		Path "/home/kendfss/Android/Sdk"
		Writable true
	NDK
		Version 24.0.8215888
		Path "/home/kendfss/Android/Sdk/ndk"
		Side-by-side true
	Build
		API 32
		Build-tools 32.1.0-rc1
	Packaging
		Format apk
Product
	Name "V Test App"
	Package ID "io.v.android"
	Output ""
V
	Version 0.2.4 abf3527
	Path "/home/kendfss/gitclone/clones/vlang/v"

	OS: linux, Linux Mint 20.3
	Processor: 4 cpus, 64bit, little endian, Intel(R) Core(TM) i5-5350U CPU @ 1.80GHz
	CC version: cc (Ubuntu 9.4.0-1ubuntu1~20.04.1) 9.4.0
	
	getwd: /home/kendfss/gitclone/clones/vlang/vab
	vmodules: /home/kendfss/.vmodules
	vroot: /home/kendfss/gitclone/clones/vlang/v
	vexe: /home/kendfss/gitclone/clones/vlang/v/v
	vexe mtime: 2022-06-06 19:55:09
	is vroot writable: true
	is vmodules writable: true
	V full version: V 0.2.4 abf3527
	
	Git version: git version 2.25.1
	Git vroot status: weekly.2022.22-61-gabf35270-dirty (61 commit(s) behind V master)
	.git/config present: true
	thirdparty/tcc status: thirdparty-linux-amd64 eee03626

What did you do?

v vab.v

What did you expect to see?

What did you see instead?

vab.v:8:1: builder error: cannot import module "vab.vxt" (not found)
    6 | import flag
    7 | import semver
    8 | import vab.vxt
      | ~~~~~~~~~~~~~~
    9 | import vab.java
   10 | import vab.android

Fix

Removing the vab. prefix from the import statements.
Done very easily with v fmt -w ., though this affects submodules in ways that weren't necessary for a successful build.

Panic while copying assets

I can see where it happens but don't know how exactly it is supposed to work? This is on newest Debian Bullseye, mixed 32/64 bit installation using Debian provided Android-SDK and NDK downloader.

$ vab -v 3  rectangles.v
sdk.default_build_tools_version=debian
Compiling V to C
Running /home/rz/prog/v/v
/home/rz/prog/v/v -dump-c-flags "/tmp/vab/v.cflags" -os android -apk rectangles.v
Running /home/rz/prog/v/v
/home/rz/prog/v/v -os android -apk -o "/tmp/vab/v_android.c" rectangles.v

Writing new hash 79639f0ac8899eb38cd6eab7d51ffb7d
Compiling C to ['arm64-v8a', 'armeabi-v7a', 'x86', 'x86_64']
Using GLES 2
Running /usr/lib/android-sdk/ndk-bundle/toolchains/llvm/prebuilt/linux-x86_64/bin/aarch64-linux-android23-clang
/usr/lib/android-sdk/ndk-bundle/toolchains/llvm/prebuilt/linux-x86_64/bin/aarch64-linux-android23-clang -O0 -fPIC -fvisibility=hidden -ffunction-sections -fdata-sections -ferror-limit=1 -Wall -Wextra -Wno-unused-variable -Wno-unused-parameter -Wno-unused-result -Wno-unused-function -Wno-missing-braces -Wno-unused-label -Werror=implicit-function-declaration -Wno-braced-scalar-init -Wno-incompatible-pointer-types -Wno-implicitly-unsigned-literal -Wno-pointer-sign -Wno-enum-conversion -Wno-int-conversion -Wno-int-to-pointer-cast -Wno-sign-compare -Wno-return-type -Wno-extra-tokens -I "/home/rz/prog/v/thirdparty/fontstash" -I "/usr/local/Cellar/freetype/2.10.2/include/freetype2" -I "/home/rz/prog/v/thirdparty/stb_image" -I "/home/rz/prog/v/thirdparty/sokol" -I "/home/rz/prog/v/thirdparty/sokol/util" -I"/usr/lib/android-sdk/ndk-bundle/sysroot/usr/include" -I"/usr/lib/android-sdk/ndk-bundle/sysroot/usr/include/android" -DAPPNAME="v_test_app" -DANDROID -D__ANDROID__ -DANDROIDVERSION=23 -DANDROID_FULLSCREEN -DSOKOL_GLES2 "/home/rz/prog/v/thirdparty/stb_image/stbi.c" -m64 -o "/tmp/vab/build/lib/arm64-v8a/libv_test_app.so" /tmp/vab/v_android.c -L"/usr/lib/android-sdk/ndk-bundle/toolchains/llvm/prebuilt/linux-x86_64/sysroot/usr/lib/aarch64-linux-android/23" -lm -uANativeActivity_onCreate -usokol_main -llog -landroid -lEGL -lGLESv2 -lm -shared
/tmp/vab/v_android.c:25445:6: warning: expression result unused [-Wunused-value]
                c->is_focused;
                ~  ^~~~~~~~~~
1 warning generated.
...
...
...
Preparing package "io.v.android"...
Removing previous package directory /tmp/vab/package/apk
Copying base files from /home/rz/prog/vab/platforms/android to /tmp/vab/package/apk
/home/rz/prog/vab/platforms/android/res/mipmap/icon.png
/home/rz/prog/vab/platforms/android/res/values/strings.xml
/home/rz/prog/vab/platforms/android/AndroidManifest.xml
/home/rz/prog/vab/platforms/android/src/io/v/android/VActivity.java
Modifying base files
Modifying native activity "/tmp/vab/package/apk/src/io/v/android/VActivity.java"
Replacing package id "io.v.android" with "io.v.android"
Replacing init library "v" with "v_test_app"
Replacing package id "io.v.android" with "io.v.android"
Replacing version code "0" with "0"
Replacing debuggable "true" with "false"
Replacing api level "21" with "23"
Copying assets
Including assets from "./assets"
Including assets from "assets"
V panic: Directory not empty
v hash: 02d823f


addr2line: 'vab': No such file
vab(+0x95c60) [0x56619c60]
addr2line: 'vab': No such file
vab(+0x8c651) [0x56610651]
addr2line: 'vab': No such file
vab(+0x8c20b) [0x5661020b]
addr2line: 'vab': No such file
vab(+0x99f88) [0x5661df88]
addr2line: 'vab': No such file
vab(+0xab1d2) [0x5662f1d2]
~/prog/v/vui-examples$ 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 7f4707e

        Path "/home/rz/prog/vab"
        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.2 02d823f
        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/.vmodules/ui/examples
        vmodules: /home/rz/.vmodules
        vroot: /home/rz/prog/v
        vexe: /home/rz/prog/v/v
        vexe mtime: 2021-08-20 22:27:00
        is vroot writable: true
        is vmodules writable: true
        V full version: V 0.2.2 02d823f

        Git version: git version 2.30.2
        Git vroot status: weekly.2021.33.2-47-g02d823fa (15 commit(s) behind V master)
        .git/config present: true
        thirdparty/tcc status: thirdparty-unknown-unknown de82a130

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.