Thanks again for helping Ammar.
Well when I started all this I had assumed Android Studio supplied the SDK, NDK, the version of JAVA it needed to work, and furthermore would set the right paths to all these things for command line builds
too, and supply readable documents for use, like other IDE compiler tools.
(gnu gcc, MS Visual Studio, etc).
Seems I was wrong.
I went back and setup java:
apt install default-jdk
which runs fine, compiling simple java console programs.
So I got a bit further, but still no luck.
This is my build-file, with SDL2 a folder within the sconnex155s folder:
-----------------------------------------------------------
#!/bin/sh
# Build script for SDL2->Android
# syntax: ./makand.sh appname file1.c [file2.c..]
#ie: ./makand.sh com.author.hello helloworld.c
#ie: ./makand.sh com.apm.sconnex sconnex.c sdlwio.c
PATH="/mnt/sda3/android-studio/plugins/android-ndk:$PATH"
PATH="/root/Android/Sdk/tools:$PATH"
PATH="/root/Android/Sdk/platform-tools:$PATH"
export ANDROID_HOME="/root/Android/Sdk"
export ANDROID_NDK_HOME="/mnt/sda3/android-studio/plugins/android-ndk"
#export JAVA_HOME="/mnt/sda3/android-studio/jbr/"
export JAVA_HOME="/usr/lib/jvm/java-17-openjdk-amd64"
#SDL2/build-scripts/androidbuild.sh com.apm.sconnex sconnex.c sdlwio.c
SDL2/build-scripts/androidbuild.sh $1 $2 $3 $4 $5 $6 $7 $8 $9
cd SDL2/build/$1
./gradlew installDebug
-----------------------------------------------------------
When I run
./makand.sh com.apm.sconnex sconnex.c sdlwio.c
I get:
-----------------------------------------------------------
./makand.sh com.apm.sconnex sconnex.c sdlwio.c
To build and install to a device for testing, run the following:
cd /mnt/sda3/w/sconnex155s/SDL2/build/com.apm.sconnex
./gradlew installDebug
> Configure project :app
This version only understands SDK XML versions up to 3 but an SDK XML file of version 4 was encountered. This can happen if you use versions of Android Studio and the command-line tools that were released at different times.
Warning: Errors during XML parse:
Warning: Additionally, the fallback loader failed to parse the XML.
Checking the license for package NDK (Side by side) 25.1.8937393 in /root/Android/Sdk/licenses
License for package NDK (Side by side) 25.1.8937393 accepted.
Preparing "Install NDK (Side by side) 25.1.8937393 v.25.1.8937393".
<======-------> 50% CONFIGURING [4m 37s]
> :app
----------------------------------------------------------------------------
And it just sits there. (phone in usb debug mode connected). The Android tools are not providing useful/adequate information on what is going wrong. Sometimes I get:
A problem occurred configuring project ':app'.
> [CXX1101] NDK at /root/Android/Sdk/ndk/25.1.8937393 did not have a source.properties file
(Deleting the folder clears the error, but still no joy)
I have tried also adding a build.gradle file with this:
android {
defaultConfig {
applicationId "com.apm.sconnex"
minSdkVersion 15
minSdkVersion 30
versionCode 1
versionName "1.0"
}
...
}
but it does not work. It nearly works, but…
Figuring I might have somehow messed something up, I have started to make a fresh minimal install of linux (Bookworm pup64) with just the command line tools needed, no studio, if that is possible.
But it is difficult to find good documents on the command line tools (particularly clear, simple well explained examples for building from the command line, what the components do, etc).