subsurface/packaging/android
Dirk Hohndel 64913bba47 android: add qmake based build for Subsurface-mobile
Several features that are needed to create Android bundles with the
current NDK and QT 5.15 aren't easily available when using cmake. Given
that we already do a qmake based build for iOS, I decided to simply
switch Android to that as well.

An added complication is that some of the magic that qmake uses to do
the right things fails if the .pro file isn't in the root directory of
your project. So this is right now somewhat inconsistent with the way we
build for iOS. Something that should get cleaned up in the near future
as it makes no sense to maintain two separate .pro files.

This commits also adds a new build shell script to drive the assembly of
all the dependencies. Once again this is a new file with the old one
left in place for now (but to be removed fairly soon).

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2020-11-19 17:18:33 -08:00
..
.gitignore
android-build-setup.sh android: add new build setup script 2020-11-19 17:18:33 -08:00
android-build-wrapper.sh android: add new build setup script 2020-11-19 17:18:33 -08:00
build.sh android: add qmake based build for Subsurface-mobile 2020-11-19 17:18:33 -08:00
install-qt.sh build-system/Android: add missing install-qt.sh 2020-04-27 11:04:29 -07:00
qmake-build.sh android: add qmake based build for Subsurface-mobile 2020-11-19 17:18:33 -08:00
qt-installer-noninteractive.qs builld-system: switch Android to Qt 5.13.1 2019-10-05 08:19:31 -07:00
README cleanup: fix image reference in Android README 2020-04-18 17:38:09 -07:00
translations.qrc android: add qmake based build for Subsurface-mobile 2020-11-19 17:18:33 -08:00
variables.sh android: add new build setup script 2020-11-19 17:18:33 -08:00
warning-ndk18b.txt Android build: add explanation for huge hack 2018-12-30 11:20:34 -08:00

Tool repo to crosscompile subsurface to android-arm
---------------------------------------------------

Dependencies:

1. android_sdk, android_ndk and Qt for android. See step 0.
2. cmake
3. ant
4. Java JDK
5. working adb is recommended
6. dependencies of libdivecomputer and subsurface -
   visit http://subsurface.hohndel.org/documentation/building/

By far the easiest way to do this is using the Android build container which is
used to create the official builds. That has all the dependencies ready and
makes things a lot easier.

Run the docker image: docker://subsurface/android-builder:5.13.10

Check out the sources inside the container, make sure the following links
are available in parallel to the source directory

        ln -s /android/Qt .
        ln -s /android/android-ndk-r18b .
        ln -s /android/android-sdk-linux .

and run the build wrapper from the directory above the source directory

        bash -x subsurface/packaging/android/android-build-wrapper.sh

This should create a pair of unsigned but otherwise working APKs (for 32 and 64
bit ARM).

Alternatively, steps to install using your own Linux machine:

Step 0.
Grab..
Android ndk from: http://developer.android.com/tools/sdk/ndk/index.html
Android sdk from: http://developer.android.com/sdk/index.html#download
And QT for android from: http://qt-project.org/downloads

Step 1.
Extract and install these into known directories.
Have a look in the top of build.sh for where the cross build tool expects
them. By default thats is: ../../../android-ndk-r9d ../../../android-sdk-linux
and ../../../Qt/5.5 (or Qt/5.6)

Step 2.
Run bash build.sh in the terminal. By default it builds for arm but you
can pass x86 as first arg to build.sh to have it build for x86. Nice when
debugging in a fast emulator.
The script will download and build the whole dependency chain.

After this, subsurface will be built for android.

The output folder is subsurface-build-arm/android_build and your newly
created apk shows up as:
subsurface-build-arm/android_build/bin/QtApp-debug.apk

Where the x86 apk shows up when built for x86 is left as a exercise for the
reader.