Good morning
I am trying to create my first .apk (android app).
I have managed to write a simple console based app using the Nim scripting language. (Managed to compile and test it on a Docker ubuntu image - to create a Windows 10 executable, also a working MacOS binary that executes correctly.)
However, now I want to see if I can compile and package my nim program to an APK that i can copy to an android device and run.
I read this: https://nim-lang.github.io/Nim/nimc.html#cross-compilation-for-android
I managed to successfully run this : nim c -c --cpu:arm --os:android -d:androidNDK --noMain:on hello.nim
But now I need guidance (exact steps to follow) to do the follow: (extract from the guide)? P.S I want to do this on the same Docker Ubuntu image (I connect to the container using VS Code)
Add the generated C files to CMake build script in your Android project. Then do the final compile with Android Studio which uses Gradle to call CMake to compile the project.
I am one step closer, I created a new docker container - after pulling this image: docker pull bitriseio/android-ndk
Then I installed the following in that container:
apt-get update apt-get install clang apt-get install mingw-w64 apt-get install -y curl curl https://nim-lang.org/choosenim/init.sh -sSf | sh apt-get install gcc-arm-linux-gnueabihf export PATH=/root/.nimble/bin:$PATH
I then managed to compile my nim program successfully using this line
nim c --cpu:arm --os:linux --parallelBuild:1 --passC:--sysroot="$SYSROOT" --passL:--sysroot="$SYSROOT" ./hello.nim
root@df06d6ea4b99:/src# nim c --cpu:arm --os:linux --parallelBuild:1 --passC:--sysroot="$SYSROOT" --passL:--sysroot="$SYSROOT" "NimProject/hello.nim" Hint: used config file '/root/.choosenim/toolchains/nim-1.0.6/config/nim.cfg' [Conf] Hint: used config file '/src/NimProject/nim.cfg' [Conf] Hint: system [Processing] Hint: widestrs [Processing] Hint: io [Processing] Hint: hello [Processing] Hint: arm-linux-gnueabihf-gcc -c -w --sysroot= -I/root/.choosenim/toolchains/nim-1.0.6/lib -I/src/NimProject -o /root/.cache/nim/hello_d/stdlib_io.nim.c.o /root/.cache/nim/hello_d/stdlib_io.nim.c [Exec] Hint: arm-linux-gnueabihf-gcc -c -w --sysroot= -I/root/.choosenim/toolchains/nim-1.0.6/lib -I/src/NimProject -o /root/.cache/nim/hello_d/stdlib_system.nim.c.o /root/.cache/nim/hello_d/stdlib_system.nim.c [Exec] Hint: arm-linux-gnueabihf-gcc -c -w --sysroot= -I/root/.choosenim/toolchains/nim-1.0.6/lib -I/src/NimProject -o /root/.cache/nim/hello_d/@mhello.nim.c.o /root/.cache/nim/hello_d/@mhello.nim.c [Exec] Hint: [Link] Hint: operation successful (14503 lines compiled; 1.093 sec total; 16MiB peakmem; Debug Build) [SuccessX]
but now what do i have to do to package this binary that was created to get an APK file that I can copy to my android device?