office-gobmx/android/Makefile
Michael Weghorn 76d50f8327 android: Stop using ANDROID_SDK_HOME env variable
Otherwise, upgrading to Android Gradle Plugin 7.1.3 and
gradle 7.2 (which will be done in a follow-up commit)
would make the build fail like this:

> FAILURE: Build failed with an exception.
>
> * Where:
> Build file '/home/michi/development/git/libreoffice-WORKTREE-for-android-x86/android/source/build.gradle' line: 1
>
> * What went wrong:
> A problem occurred evaluating root project 'source'.
> > Failed to apply plugin 'com.android.internal.application'.
>    > ANDROID_SDK_HOME is set to the root of your SDK: /home/michi/Android/Sdk
>      ANDROID_SDK_HOME was meant to be the parent path of the preference folder expected by the Android tools.
>      It is now deprecated.
>
>      To set a custom preference folder location, use ANDROID_USER_HOME.
>
>      It should NOT be set to the same directory as the root of your SDK.
>      To set a custom SDK location, use ANDROID_HOME.

We don't actually rely on `ANDROID_SDK_HOME` being evaluated
by the Android toolchain, but it used to be set in configure.ac,
and the value was then assigned to the `sdk.dir` property written to
`android/source/local.properties`.

Just use a new variable name `ANDROID_SDK_DIR`
and keep the mechanism otherwise unchanged for now.

Change-Id: I44826621a1342119d40036fb704d8ff1eeed7c77
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/133178
Tested-by: Jenkins
Reviewed-by: Michael Weghorn <m.weghorn@posteo.de>
2022-04-20 05:19:20 +02:00

32 lines
1.3 KiB
Makefile

# -*- Mode: makefile-gmake; tab-width: 4; indent-tabs-mode: t -*-
#
# This file is part of the LibreOffice project.
#
# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
module_directory:=$(dir $(realpath $(firstword $(MAKEFILE_LIST))))
include $(module_directory)/../solenv/gbuild/partial_build.mk
.PHONY: sign
SIGNED_APK := $(BUILDDIR)/android/source/bin/LibreOfficeViewer.apk
RELEASE_APK_USAGE := echo; echo "Usage: make versionCode=<version_num+1> exampleDocument=</absolute/path/example.odt> key=<key_name> release-apk"
release-apk: build
# versionCode and key are mandatory, exampleDocument is not
@if test -z "$(versionCode)" ; then $(RELEASE_APK_USAGE) ; exit 1 ; fi
@if test -z "$(key)" ; then $(RELEASE_APK_USAGE) ; exit 1 ; fi
rm -f $(SIGNED_APK)
# the actual signing
jarsigner --verbose -verbose -sigalg SHA1withRSA -digestalg SHA1 -keystore ~/.keystore $(BUILDDIR)/android/source/build/outputs/apk/LibreOfficeViewer-strippedUI-release-unsigned.apk $(key)
$(ANDROID_SDK_DIR)/build-tools/*/zipalign -v 4 $(BUILDDIR)/android/source/build/outputs/apk/LibreOfficeViewer-strippedUI-release-unsigned.apk $(SIGNED_APK)
@echo
@echo "Resulting signed apk: $(SIGNED_APK)"
# vim: set noet sw=4 ts=4: