Commit b56ebf80 authored by Benoit Lavenier's avatar Benoit Lavenier
Browse files

[enh] Try to compile for OLD Android version (API 19)

parent 50fdc171
Pipeline #11259 failed
<?xml version='1.0' encoding='utf-8'?>
<widget android-versionCode="106012" id="fr.duniter.cesium" ios-CFBundleIdentifier="org.duniter.cesium" version="1.6.12" xmlns="http://www.w3.org/ns/widgets" xmlns:android="http://schemas.android.com/apk/res/android" xmlns:cdv="http://cordova.apache.org/ns/1.0">
<widget android-versionCode="106120" id="fr.duniter.cesium" ios-CFBundleIdentifier="org.duniter.cesium" version="1.6.13" xmlns="http://www.w3.org/ns/widgets" xmlns:android="http://schemas.android.com/apk/res/android" xmlns:cdv="http://cordova.apache.org/ns/1.0">
<name>Cesium</name>
<description>
An simple App for Duniter wallet
......@@ -58,7 +58,7 @@
<platform name="android">
<preference name="AndroidXEnabled" value="true" />
<preference name="AndroidLaunchMode" value="singleTask" />
<preference name="android-minSdkVersion" value="22" />
<preference name="android-minSdkVersion" value="19" />
<preference name="android-targetSdkVersion" value="29" />
<icon density="ldpi" src="resources/android/icon/drawable-ldpi-icon.png" />
<icon density="mdpi" src="resources/android/icon/drawable-mdpi-icon.png" />
......
......@@ -9,6 +9,8 @@ export PROJECT_DIR
# Preparing environment
. "${PROJECT_DIR}/scripts/env-global.sh"
BUILD_TOOLS_DIR="${ANDROID_SDK_ROOT}/build-tools/${ANDROID_SDK_VERSION}/"
if test -z "${CORDOVA_ANDROID_GRADLE_DISTRIBUTION_URL}"; then
echo "ERROR: Missing Gradle distribution URL - please export env variable 'CORDOVA_ANDROID_GRADLE_DISTRIBUTION_URL'"
fi
......@@ -28,7 +30,7 @@ if test -z "${JAVAC_PATH}"; then
fi
# Prepare Android SDK tools
if ! test -d "${ANDROID_SDK_ROOT}/build-tools/${ANDROID_SDK_VERSION}" || ! test -d "${ANDROID_SDK_CLI_ROOT}/tools/bin"; then
if ! test -d "${BUILD_TOOLS_DIR}" || ! test -d "${ANDROID_SDK_CLI_ROOT}/tools/bin"; then
. ${PROJECT_DIR}/scripts/install-android-sdk.sh
if test $? -ne 0; then
echo "ERROR: Unable to install Android SDK Tools & CLI"
......@@ -83,6 +85,11 @@ if test $? -ne 0; then
echo "ERROR: Check Cordova requirements failed"
fi
export PATH=${GRADLE_HOME}/bin:${PATH}
# Add Gradle to path
PATH=${GRADLE_HOME}/bin:${PATH}
# Export useful variables
export PATH \
BUILD_TOOLS_DIR
echo "Android environment is ready!"
......@@ -24,7 +24,7 @@ NODEJS_VERSION=12
#NODE_OPTIONS=--max-old-space-size=4096
ANDROID_NDK_VERSION=19.2.5345600
ANDROID_SDK_VERSION=29.0.3
ANDROID_SDK_VERSION=21.1.1
ANDROID_SDK_CLI_VERSION=6858069
ANDROID_SDK_ROOT="${HOME}/Android/Sdk"
ANDROID_ALTERNATIVE_SDK_ROOT=/usr/lib/android-sdk
......
......@@ -45,6 +45,7 @@ echo y | sdkmanager "extras;google;m2repository" "--sdk_root=${ANDROID_SDK_ROOT}
# Install build tools
echo "Installing Android build-tools..."
echo y | sdkmanager "build-tools;21.1.1" --sdk_root=${ANDROID_SDK_ROOT} | tee -a sdkmanager.log
echo y | sdkmanager "build-tools;${ANDROID_SDK_VERSION}" --sdk_root=${ANDROID_SDK_ROOT} | tee -a sdkmanager.log
[[ $? -ne 0 ]] && exit 1
......
......@@ -7,19 +7,19 @@ if [[ "_" == "_${PROJECT_DIR}" ]]; then
export PROJECT_DIR
fi;
# Default env (can be override in file <PROJECT>/.local/env.sh)
# Default env variables (can be override in '.local/env.sh' file)
KEYSTORE_FILE=${PROJECT_DIR}/.local/android/Cesium.keystore
KEY_ALIAS=Cesium
KEYSTORE_PWD=
APK_RELEASE_DIR=${PROJECT_DIR}/platforms/android/app/build/outputs/apk/release
APK_UNSIGNED_FILE=${APK_RELEASE_DIR}/app-release-unsigned.apk
APK_SIGNED_FILE=${APK_RELEASE_DIR}/app-release.apk
# Preparing Android environment
. ${PROJECT_DIR}/scripts/env-android.sh
source ${PROJECT_DIR}/scripts/env-android.sh
[[ $? -ne 0 ]] && exit 1
APK_UNSIGNED_FILE=${ANDROID_OUTPUT_APK_RELEASE}/app-release-unsigned.apk
APK_SIGNED_FILE=${ANDROID_OUTPUT_APK_RELEASE}/app-release.apk
cd ${PROJECT_DIR}
# Sign files
......
......@@ -7,10 +7,18 @@ if [[ "_" == "_${PROJECT_DIR}" ]]; then
export PROJECT_DIR
fi;
# Default env variables (can be override in '.local/env.sh' file)
KEYSTORE_FILE=${PROJECT_DIR}/.local/Cesium.keystore
KEY_ALIAS=Cesium
KEY_PWD=
# Preparing Android environment
source ${PROJECT_DIR}/scripts/env-android.sh
[[ $? -ne 0 ]] && exit 1
APK_UNSIGNED_FILE=${ANDROID_OUTPUT_APK_RELEASE}/app-release-unsigned.apk
APK_SIGNED_FILE=${ANDROID_OUTPUT_APK_RELEASE}/app-release.apk
cd ${PROJECT_DIR}
# Run the build
......@@ -18,13 +26,6 @@ echo "Running cordova build..."
ionic cordova build android --warning-mode=none --color --prod --release
[[ $? -ne 0 ]] && exit 1
# Signature
KEYSTORE_FILE=${PROJECT_DIR}/.local/Cesium.keystore
KEY_ALIAS=Cesium
KEY_PWD=
APK_DIR=${PROJECT_DIR}/platforms/android/build/outputs/apk/release
APK_UNSIGNED_FILE=${APK_DIR}/android-release.apk
BUILD_TOOLS_DIR="${ANDROID_SDK_ROOT}/build-tools/28.*/"
if [[ ! -f "${APK_UNSIGNED_FILE}" ]]; then
echo "APK file not found at: ${APK_UNSIGNED_FILE}"
......@@ -48,7 +49,7 @@ if [[ $? -ne 0 ]]; then
jarsigner -verbose -sigalg SHA1withRSA -digestalg SHA1 -keystore ${KEYSTORE_FILE} ${APK_UNSIGNED_FILE} Cesium
BUILD_TOOLS_DIR="${ANDROID_SDK_ROOT}/build-tools/28.*/"
BUILD_TOOLS_DIR="${ANDROID_SDK_ROOT}/build-tools/${ANDROID_SDK_VERSION}/"
cd ${BUILD_TOOLS_DIR}
./zipalign -v 4 ${APK_UNSIGNED_FILE} ${APK_SIGNED_FILE}
......
This diff is collapsed.
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment