Android dependencies

Android dependencies

Postby forum » 26 May 2020, 07:06

Hello,

What is the difference between these 3 dependency archives for Android?

https://github.com/supertuxkart/depende ... /master?q=

android/dependencies-android-1.1.1.tar.xz
android/dependencies-android-ndk20.tar.xz
android/dependencies-android.tar.xz

Which should I extract to stk-code/lib/ ?
Best regards, 7wells
forum
 
Posts: 176
Joined: 04 May 2020, 12:29

Re: Android dependencies

Postby benau » 26 May 2020, 08:07

android/dependencies-android-1.1.1.tar.xz if you are compiling latest master
Image
benau
STK Moderator
 
Posts: 505
Joined: 08 Dec 2015, 17:32

Re: Android dependencies

Postby forum » 26 May 2020, 16:04

Thank you! I could compile STK under Ubuntu and it runs there. :)

Now sorry about my dumb question: But how do I compile for Android? Is there a cross-compilation toolchain or something? I do not understand the note about the dependencies for Android when it is compiled under Linux (e.g. Ubuntu). Where/how is the Android package (apk) built? Since I am fairly new to software development, please bear with me and my humble questions. :blush:
Best regards, 7wells
forum
 
Posts: 176
Joined: 04 May 2020, 12:29

Re: Android dependencies

Postby benau » 26 May 2020, 16:45

Image
benau
STK Moderator
 
Posts: 505
Joined: 08 Dec 2015, 17:32

Re: Android dependencies

Postby forum » 26 May 2020, 17:14

Oh my bad - I should of course have read the rest as well. :blush: Sorry that I wasted your time!
I will now dig into this and see how much progress I can to on Android.

PS - sorry, one more question about this:
You need also Android SDK for android-19 platform (the API for Android 4.4) and
Android NDK. Version r20 is recommended, because it's known that it works
without issues.


When I go to this page, I only see one version for Linux:
{l Code}: {l Select All Code}
Linux (64-bit)    android-studio-ide-192.6392135-linux.tar.gz (772 MB)

Is this the correct one?
Best regards, 7wells
forum
 
Posts: 176
Joined: 04 May 2020, 12:29

Re: Android dependencies

Postby QwertyChouskie » 26 May 2020, 17:33

AFAIK, once Android Studio is installed, you can download the version of the SDK you need from Tools->SDK Manager.
Contributor to/fan of STK (Upstreamed Cartoon theme, numerous random big fixes/tweaks)
User avatar
QwertyChouskie
 
Posts: 559
Joined: 29 Jun 2016, 14:57

Re: Android dependencies

Postby forum » 26 May 2020, 17:58

The command line tools only are not sufficient, or are they?
Command line tools only
If you do not need Android Studio, you can download the basic Android command line tools below. You can use the included sdkmanager to download other SDK packages.


I just wonder why should I download that stuff, when I could also do this?
{l Code}: {l Select All Code}
sudo apt install android-sdk


PS:
Is it still true as of today that Android NDK version r20 is recommended, because it's known that it works without issues? Meanwhile, there is NDK r21b.
Best regards, 7wells
forum
 
Posts: 176
Joined: 04 May 2020, 12:29

Re: Android dependencies

Postby QwertyChouskie » 26 May 2020, 18:31

Yes, those command-line tools should do the job AFAIK (you had just posted a link to full Android Studio, so I based my answer around it.)
Contributor to/fan of STK (Upstreamed Cartoon theme, numerous random big fixes/tweaks)
User avatar
QwertyChouskie
 
Posts: 559
Joined: 29 Jun 2016, 14:57

Re: Android dependencies

Postby benau » 26 May 2020, 18:33

You can build with r21 if u compile the git with 1.1.1 pack
Image
benau
STK Moderator
 
Posts: 505
Joined: 08 Dec 2015, 17:32

Re: Android dependencies

Postby forum » 26 May 2020, 19:21

Thank you both! I am still setting everything up. For those other interested users, you might find the following links useful about installing Android SDK and NDK on Linux/Ubuntu. Well, the following worked for me:
{l Code}: {l Select All Code}
sudo apt update && sudo apt install android-sdk


But then I ran into some problem (Android command line tool sdkmanager always shows: Warning: Could not create settings), which I could resolve with hints there:
https://stackoverflow.com/questions/604 ... -create-se
Search for this comment:
The sdkmanager tries to figure out the android-sdk path based in where it's unpacked, without use the environment variables, like ANDROID_SDK_ROOT. But it's get worse, because it have a hard coded parent folder named cmdline-tools and if you unzip commandlinetools inside a folder with another name, it doesn't work, forcing us to use the parameter sdk_root to feed the inside variable correctly.

So, with that in mind we can use the following approach to solve this.
...


And then I got:
{l Code}: {l Select All Code}
sdkmanager "Warning: Failed to read or create install properties file"

WHich I could resolve with this:
{l Code}: {l Select All Code}
sudo chmod -R a+w [path/to/android/sdk]

Hint sources:
https://askubuntu.com/questions/1227439 ... line-tools
https://github.com/bitrise-steplib/step ... /issues/57

Finally, I installed the NDK (well, I hope that is correct):
{l Code}: {l Select All Code}
sdkmanager --no_https ndk-bundle


More is there:
https://linoxide.com/linux-how-to/insta ... er-ubuntu/

I will look further into this in the following days and hope that it is ok that I post these details and links here (maybe helpful for others as well).
Best regards, 7wells
forum
 
Posts: 176
Joined: 04 May 2020, 12:29

Re: Android dependencies

Postby forum » 26 May 2020, 21:05

benau {l Wrote}:https://github.com/supertuxkart/stk-code/blob/master/android/README.ANDROID

Before running the compilation, run the generate_assets script, so that
selected assets will be copied to "assets" directory, and then included in the
apk file.

Can you please provide me with some more guidance how to do this? I.e. where is the generate_assets script located?
Thanks a lot!
Best regards, 7wells
forum
 
Posts: 176
Joined: 04 May 2020, 12:29

Re: Android dependencies

Postby benau » 27 May 2020, 04:12

it's all in android folder
Image
benau
STK Moderator
 
Posts: 505
Joined: 08 Dec 2015, 17:32

Re: Android dependencies

Postby forum » 27 May 2020, 11:07

Thank you. So I set the environment paths and symlinks for SDK and NDK and can execute make:
user@ubuntu:~/stk-code/android$ ./make.sh -j5
./make.sh: 226: [: =: argument expected
Creating standalone toolchain
HOST_OS=linux
HOST_EXE=
HOST_ARCH=x86_64
HOST_TAG=linux-x86_64
HOST_NUM_CPUS=4
BUILD_NUM_CPUS=8

What does "226: [: =: argument expected" right after the call mean?

The host (Synology DS918+ with QuadCore CPU and 8 GB RAM) is shown as "HOST_NUM_CPUS=4" as expected; however, why is "BUILD_NUM_CPUS=8" when I invoke the make process with "-j5" (5 threads)? If this is not really relevant or/and off-topic here, please ignore this question.

PS for the record: The build process (with all 26 actionable tasks executed) took about 5 minutes.
Best regards, 7wells
forum
 
Posts: 176
Joined: 04 May 2020, 12:29

Re: Android dependencies

Postby forum » 27 May 2020, 13:25

Success! I got "android-debug.apk", could install it on my Samsung Galaxy S7 EDIT: and also on my Fire TV stick - and it runs. :)
So it seems that I have a working development/testing environment.

Thanks once more for your kind patience and helpful hints! :heart:
Best regards, 7wells
forum
 
Posts: 176
Joined: 04 May 2020, 12:29

Re: Android dependencies

Postby forum » 18 Jun 2020, 17:37

forum {l Wrote}:What does "226: [: =: argument expected" right after the call mean?

It appears immediately after make (but the compilation runs through nevertheless):
{l Code}: {l Select All Code}
user@ubuntu:~/stk-code/android$ ./make.sh -j5
./make.sh: 226: [: =: argument expected
Compiling STK

If 226 is the code line number in make.sh (I am not sure about this, as I am not an expert of coding and such), then here is the code block in question (I added the line numbers 221 to 231):
{l Code}: {l Select All Code}
221    # Find newest build-tools version
222    if [ -z "$BUILD_TOOLS_VER" ]; then
223        BUILD_TOOLS_DIRS=`ls -1 "$SDK_PATH/build-tools" | sort -V -r`
224       
225        for DIR in $BUILD_TOOLS_DIRS; do
226            if [ "$DIR" = `echo $DIR | sed 's/[^0-9,.]//g'` ]; then
227                BUILD_TOOLS_VER="$DIR"
228                break
229            fi
230        done
231    fi

So is there maybe a problem in line 226 of make.sh?
{l Code}: {l Select All Code}
if [ "$DIR" = `echo $DIR | sed 's/[^0-9,.]//g'` ]; then

I do not know what [: =: argument expected means, sorry.
Best regards, 7wells
forum
 
Posts: 176
Joined: 04 May 2020, 12:29

Re: Android dependencies

Postby forum » 18 Jun 2020, 18:02

The build process ends like this:
{l Code}: {l Select All Code}
Building APK
Starting a Gradle Daemon (subsequent builds will be faster)

> Configure project :
Observed package id 'build-tools;debian' in inconsistent location '/usr/lib/android-sdk/build-tools/27.0.1' (Expected '/usr/lib/android-sdk/build-tools/debian')

BUILD SUCCESSFUL in 1m 24s
26 actionable tasks: 7 executed, 19 up-to-date

Should I be concerned about the message regarding the inconsistent location? Is a softlink (ln -s) needed here?

The apk is there:
{l Code}: {l Select All Code}
user@ubuntu:~/stk-code/android/build/outputs/apk/debug
-rw-rw-r-- 1 user user 118174443 Jun 18 18:49 android-debug.apk
-rw-rw-r-- 1 user user       234 Jun 18 18:49 output.json

What is the json file for?
Last edited by forum on 19 Jun 2020, 09:36, edited 2 times in total.
Best regards, 7wells
forum
 
Posts: 176
Joined: 04 May 2020, 12:29

Re: Android dependencies

Postby deve » 18 Jun 2020, 20:50

Can you show content of the build-tools directory? The 226 line probably should have quotes around command. And I think that you don't need to care about that json file.
deve
 
Posts: 268
Joined: 23 Jan 2014, 13:45

Re: Android dependencies

Postby forum » 18 Jun 2020, 21:00

Thank you so much for your help! :)
Since I am unsure, which folder you mean, I show several:
{l Code}: {l Select All Code}
user@ubuntu:~/stk-code
drwxrwxr-x 10 user user  4096 Jun 18 18:47 android
-rw-rw-r--  1 user user  1916 Mai 25 22:34 .appveyor.yml
-rw-rw-r--  1 user user   161 Mai 25 22:34 Brewfile
-rw-rw-r--  1 user user 26213 Mai 25 22:34 CHANGELOG.md
drwxrwxr-x  2 user user  4096 Jun 16 20:37 cmake
drwxrwxr-x  5 user user  4096 Mai 26 16:14 cmake_build
-rw-rw-r--  1 user user 29602 Jun 16 20:37 CMakeLists.txt
-rw-rw-r--  1 user user 35245 Mai 25 22:34 COPYING
drwxrwxr-x 11 user user  4096 Mai 25 22:34 data
drwxrwxr-x  2 user user  4096 Mai 25 22:34 doc
drwxrwxr-x  8 user user  4096 Jun 18 15:46 .git
drwxrwxr-x  2 user user  4096 Mai 25 22:34 .github
-rw-rw-r--  1 user user   919 Mai 25 22:34 .gitignore
-rw-rw-r--  1 user user 12831 Mai 25 22:34 INSTALL.md
drwxrwxr-x 25 user user  4096 Mai 26 16:12 lib
-rw-rw-r--  1 user user 23317 Mai 25 22:34 NETWORKING.md
-rw-rw-r--  1 user user  2213 Mai 25 22:34 README.md
-rw-rw-r--  1 user user   485 Jun 18 15:46 sources.cmake
drwxrwxr-x 27 user user  4096 Jun 16 20:37 src
lrwxrwxrwx  1 user user    20 Mai 27 12:31 stk-code -> /home/user/stk-code/
drwxrwxr-x  4 user user  4096 Jun 16 20:37 tools
-rw-rw-r--  1 user user  2147 Mai 25 22:34 .travis.yml


{l Code}: {l Select All Code}
user@ubuntu:~/stk-code/android
-rw-rw-r--  1 user user  2620 Jun 18 18:47 AndroidManifest.xml
-rw-rw-r--  1 user user 10162 Mai 25 22:34 Android.mk
lrwxrwxrwx  1 user user    32 Mai 27 11:01 android-ndk -> /usr/lib/android-sdk/ndk-bundle/
lrwxrwxrwx  1 user user    20 Jun 18 18:18 android-sdk -> /usr/lib/android-sdk
drwxrwxr-x  3 user user  4096 Jun 18 16:13 assets
-rw-rw-r--  1 user user 28755 Mai 25 22:34 banner.png
drwxrwxr-x  6 user user  4096 Mai 27 12:49 build
-rw-rw-r--  1 user user   688 Mai 25 22:34 build.gradle
-rwxrwxr-x  1 user user 17761 Mai 25 22:34 generate_assets.sh
drwxrwxr-x  5 user user  4096 Mai 27 12:49 .gradle
drwxrwxr-x  3 user user  4096 Mai 25 22:34 gradle
-rwxrwxr-x  1 user user  4971 Mai 25 22:34 gradlew
-rw-rw-r--  1 user user 16198 Mai 25 22:34 icon_adaptive_fg-dbg.png
-rw-rw-r--  1 user user 15662 Mai 25 22:34 icon_adaptive_fg.png
-rw-rw-r--  1 user user 15920 Mai 25 22:34 icon-dbg.png
-rw-rw-r--  1 user user 15178 Mai 25 22:34 icon.png
drwxrwxr-x  3 user user  4096 Mai 27 12:18 libs
-rwxrwxr-x  1 user user 22641 Mai 25 22:34 make.sh
drwxrwxr-x 27 user user  4096 Mai 27 12:18 obj
-rw-rw-r--  1 user user  5186 Mai 25 22:34 README.ANDROID
drwxrwxr-x 10 user user  4096 Mai 27 12:45 res
drwxrwxr-x  3 user user  4096 Mai 25 22:34 src


{l Code}: {l Select All Code}
user@ubuntu:~/stk-code/tools
drwxrwxr-x  2 user user  4096 Mai 25 22:34 ai_test
-rwxrwxr-x  1 user user  6817 Mai 25 22:34 android_builder.sh
-rwxrwxr-x  1 user user  1460 Mai 25 22:34 build-linux-travis.sh
-rwxrwxr-x  1 user user  6264 Mai 25 22:34 check_textures.py
-rwxrwxr-x  1 user user  3390 Mai 25 22:34 compute_client_error.py
-rwxrwxr-x  1 user user 11587 Mai 25 22:34 create_kart_properties.py
-rwxrwxr-x  1 user user   408 Mai 25 22:34 find_unused.sh
-rwxrwxr-x  1 user user   940 Mai 25 22:34 generate-countries-table.py
-rw-rw-r--  1 user user  2020 Mai 25 22:34 generate-country-names.java
-rwxrwxr-x  1 user user  2516 Mai 25 22:34 generate-ip-mappings.py
-rwxrwxr-x  1 user user    53 Mai 25 22:34 get_rendered_data
-rw-rw-r--  1 user user  3130 Mai 25 22:34 ibl.py
-rwxrwxr-x  1 user user 29320 Jun 16 20:37 linux_builder.sh
-rwxrwxr-x  1 user user  3106 Mai 25 22:34 network_race_statistics
-rwxrwxr-x  1 user user  4502 Mai 25 22:34 remove-whitespaces.py
-rwxrwxr-x  1 user user 11911 Mai 25 22:34 run_server.sh
-rwxrwxr-x  1 user user   882 Mai 25 22:34 simplify_challenges.sh
-rwxrwxr-x  1 user user  2103 Mai 25 22:34 update_characteristics.py
-rwxrwxr-x  1 user user   719 Mai 25 22:34 update_copyright.sh
drwxrwxr-x  3 user user  4096 Mai 25 22:34 windows_installer


{l Code}: {l Select All Code}
user@ubuntu:~/stk-code/cmake
-rw-rw-r--  1 user user  981 Mai 25 22:34 BuildTypeSTKRelease.cmake
-rw-rw-r--  1 user user  945 Mai 25 22:34 FindAngelscript.cmake
-rw-rw-r--  1 user user  464 Mai 25 22:34 FindEGL.cmake
-rw-rw-r--  1 user user 1132 Mai 25 22:34 FindFreetype.cmake
-rw-rw-r--  1 user user 1158 Mai 25 22:34 FindFribidi.cmake
-rw-rw-r--  1 user user 2006 Mai 25 22:34 FindLibbfd.cmake
-rw-rw-r--  1 user user 1751 Mai 25 22:34 FindOggVorbis.cmake
-rw-rw-r--  1 user user 2472 Mai 25 22:34 FindWayland.cmake
-rw-rw-r--  1 user user 2259 Mai 25 22:34 FindWiiUse.cmake
-rw-rw-r--  1 user user 1453 Mai 25 22:34 SourceGroupFunctions.cmake
-rw-rw-r--  1 user user 1521 Mai 25 22:34 Toolchain-android.cmake
-rw-rw-r--  1 user user 1794 Jun 16 20:37 Toolchain-ios.cmake
-rw-rw-r--  1 user user 7057 Mai 25 22:34 Toolchain-ios-xcode.cmake
-rw-rw-r--  1 user user  959 Mai 25 22:34 Toolchain-llvm-mingw-64bit.cmake
-rw-rw-r--  1 user user  939 Mai 25 22:34 Toolchain-llvm-mingw.cmake
-rw-rw-r--  1 user user 1039 Mai 25 22:34 Toolchain-mingw-64bit.cmake
-rw-rw-r--  1 user user 1009 Mai 25 22:34 Toolchain-mingw.cmake


{l Code}: {l Select All Code}
user@ubuntu:~/stk-code/cmake_build
drwxrwxr-x  2 user user   4096 Mai 25 23:03 bin
-rw-rw-r--  1 user user  54442 Mai 25 22:42 CMakeCache.txt
drwxrwxr-x  6 user user   4096 Mai 26 16:14 CMakeFiles
-rw-rw-r--  1 user user   4962 Mai 25 22:42 cmake_install.cmake
drwxrwxr-x 11 user user   4096 Mai 25 22:42 lib
-rw-rw-r--  1 user user 519293 Mai 26 16:14 Makefile
Last edited by forum on 19 Jun 2020, 09:36, edited 2 times in total.
Best regards, 7wells
forum
 
Posts: 176
Joined: 04 May 2020, 12:29

Re: Android dependencies

Postby deve » 18 Jun 2020, 22:16

stk-code/android/android-sdk/build-tools

There is probably "debian" directory and the script didn't expect it to be there. Do you have standard build-tools with numbers there too? Eg. 29.0.2 or something like this.
deve
 
Posts: 268
Joined: 23 Jan 2014, 13:45

Re: Android dependencies

Postby forum » 19 Jun 2020, 05:07

{l Code}: {l Select All Code}
user@ubuntu:~/stk-code/android/android-sdk
drwxrwxrwx   4 root root 4096 Mai 27 12:48 build-tools
drwxrwxrwx   3 root root 4096 Mai 26 20:04 cmdline-tools
-rw-rw-r--   1 user user   16 Jun 18 18:48 .knownPackages
drwxrwxrwx   2 root root 4096 Mai 26 20:13 licenses
drwxrwxr-x  15 user user 4096 Mai 26 20:21 ndk-bundle
drwxrwxr-x   3 user user 4096 Mai 26 20:13 patcher
drwxrwxrwx   4 root root 4096 Mai 27 12:49 platforms
drwxrwxrwx   2 root root 4096 Mai 26 19:37 platform-tools
drwxrwxr-x   2 user user 4096 Mai 26 20:21 .temp
drwxrwxrwx   4 root root 4096 Mai 26 19:37 tools


{l Code}: {l Select All Code}
user@ubuntu:~/stk-code/android/android-sdk/build-tools
lrwxrwxrwx  1 root root    6 Aug 29  2019 27.0.1 -> debian
drwxrwxr-x  5 user user 4096 Mai 27 12:48 28.0.3
drwxrwxrwx  3 root root 4096 Mai 26 19:37 debian


There is a softlink regarding the standard Debian build tool - see above.
However, now I wonder why I have both: 27.0.1 (softlinked) and 28.0.3?

PS (if that matters at all):
Also the different user:group (root:root vs. user:user) makes me wonder.
I installed SDK and NDK as root and created the softlinks as root (if I remember correctly), whereas I pulled git, updated the assets, and started the build process as user.


And I should mention:

The built android-debug.apk runs perfectly on a Samsung S5 mini phone. :)
Is there anything I should specifically test and report back here (or on GitHub?) on the latest Android git version?
Best regards, 7wells
forum
 
Posts: 176
Joined: 04 May 2020, 12:29

Re: Android dependencies

Postby deve » 19 Jun 2020, 17:51

Because different projects need different build-tools versions, so you can install more of them. STK uses newest available version by default.

You shouldn't see this warning in current git anymore.
deve
 
Posts: 268
Joined: 23 Jan 2014, 13:45

Re: Android dependencies

Postby forum » 20 Jun 2020, 08:14

Thank you! :)
Best regards, 7wells
forum
 
Posts: 176
Joined: 04 May 2020, 12:29

Who is online

Users browsing this forum: No registered users and 1 guest