diff --git a/.github/workflows/android.yml b/.github/workflows/android.yml index 387fc715ad1c..02de57c6ccec 100644 --- a/.github/workflows/android.yml +++ b/.github/workflows/android.yml @@ -51,7 +51,7 @@ jobs: uses: actions/setup-java@v4 with: distribution: temurin - java-version: 11 + java-version: 17 - uses: actions/checkout@v4 with: diff --git a/CMakeLists.txt b/CMakeLists.txt index 4e249ef4672b..672ef22aa1ec 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -245,7 +245,7 @@ elseif(ANDROID) PROPERTIES QT_ANDROID_ABIS ${ANDROID_ABI} QT_ANDROID_MIN_SDK_VERSION 26 - QT_ANDROID_TARGET_SDK_VERSION 33 + QT_ANDROID_TARGET_SDK_VERSION 34 QT_ANDROID_PACKAGE_SOURCE_DIR ${CMAKE_SOURCE_DIR}/android QT_ANDROID_VERSION_NAME "${CMAKE_PROJECT_VERSION}" # QT_ANDROID_VERSION_CODE "${CMAKE_PROJECT_VERSION}" diff --git a/android/AndroidManifest.xml b/android/AndroidManifest.xml index 5d26f8c742fd..ac9c78b03b70 100644 --- a/android/AndroidManifest.xml +++ b/android/AndroidManifest.xml @@ -1,20 +1,32 @@ - - - + + + + + + + + + + + + + + + + + android:icon="@drawable/icon" + android:usesCleartextTraffic="true" + android:networkSecurityConfig="@xml/network_security_config"> + + + + + - - - - - + + + + + + + + android:resource="@xml/qtprovider_paths" /> - - - - - - + - - - - - - diff --git a/android/build.gradle b/android/build.gradle index 431a13c152a4..3912e9f43d79 100644 --- a/android/build.gradle +++ b/android/build.gradle @@ -5,7 +5,7 @@ buildscript { } dependencies { - classpath 'com.android.tools.build:gradle:7.4.1' + classpath 'com.android.tools.build:gradle:8.3.2' } } @@ -18,7 +18,7 @@ apply plugin: 'com.android.application' dependencies { implementation fileTree(dir: 'libs', include: ['*.jar', '*.aar']) - implementation 'androidx.core:core:1.10.1' + implementation 'androidx.core:core:1.12.0' } android { @@ -60,8 +60,8 @@ android { } compileOptions { - sourceCompatibility JavaVersion.VERSION_1_8 - targetCompatibility JavaVersion.VERSION_1_8 + sourceCompatibility JavaVersion.VERSION_17 + targetCompatibility JavaVersion.VERSION_17 } lintOptions { @@ -75,8 +75,24 @@ android { defaultConfig { resConfig "en" - minSdkVersion 25 + minSdkVersion qtMinSdkVersion targetSdkVersion qtTargetSdkVersion ndk.abiFilters = qtTargetAbiList.split(",") + + namespace "org.mavlink.qgroundcontrol" + // versionName "0.7" + // versionCode timestampInt + + println "minSdkVersion: ${minSdkVersion}" + println "targetSdkVersion: ${targetSdkVersion}" + println "ndk.abiFilters: ${ndk.abiFilters}" + println "versionCode: ${versionCode}" + println "versionName: ${versionName}" } + + println "androidCompileSdkVersion: ${compileSdkVersion}" + println "androidBuildToolsVersion: ${buildToolsVersion}" + println "androidNdkVersion: ${ndkVersion}" + println "project.name: ${project.name}" + println "qtAndroidDir: ${qtAndroidDir}" } diff --git a/android/gradle.properties b/android/gradle.properties new file mode 100644 index 000000000000..c40f8d02ca7f --- /dev/null +++ b/android/gradle.properties @@ -0,0 +1,26 @@ +# Project-wide Gradle settings. +# For more details on how to configure your build environment visit +# http://www.gradle.org/docs/current/userguide/build_environment.html + +# Specifies the JVM arguments used for the daemon process. +# The setting is particularly useful for tweaking memory settings. +org.gradle.jvmargs=-Xmx2500m -XX:MaxMetaspaceSize=512m -XX:+HeapDumpOnOutOfMemoryError -Dfile.encoding=UTF-8 + +# Enable building projects in parallel +org.gradle.parallel=true + +# Gradle caching allows reusing the build artifacts from a previous +# build with the same inputs. However, over time, the cache size will +# grow. Uncomment the following line to enable it. +#org.gradle.caching=true +#org.gradle.configuration-cache=true + +# Allow AndroidX usage +android.useAndroidX=true + +#androidCompileSdkVersion=34 +#androidBuildToolsVersion=34.0.0 +#androidNdkVersion=26.1.10909125 + +#qtMinSdkVersion=23 +#qtTargetSdkVersion=34 diff --git a/android/gradle/wrapper/gradle-wrapper.jar b/android/gradle/wrapper/gradle-wrapper.jar new file mode 100644 index 000000000000..e6441136f3d4 Binary files /dev/null and b/android/gradle/wrapper/gradle-wrapper.jar differ diff --git a/android/gradle/wrapper/gradle-wrapper.properties b/android/gradle/wrapper/gradle-wrapper.properties new file mode 100644 index 000000000000..b82aa23a4f05 --- /dev/null +++ b/android/gradle/wrapper/gradle-wrapper.properties @@ -0,0 +1,7 @@ +distributionBase=GRADLE_USER_HOME +distributionPath=wrapper/dists +distributionUrl=https\://services.gradle.org/distributions/gradle-8.7-bin.zip +networkTimeout=10000 +validateDistributionUrl=true +zipStoreBase=GRADLE_USER_HOME +zipStorePath=wrapper/dists diff --git a/android/gradlew b/android/gradlew new file mode 100755 index 000000000000..97de990bb40f --- /dev/null +++ b/android/gradlew @@ -0,0 +1,249 @@ +#!/bin/sh + +# +# Copyright © 2015-2021 the original authors. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# https://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# + +############################################################################## +# +# Gradle start up script for POSIX generated by Gradle. +# +# Important for running: +# +# (1) You need a POSIX-compliant shell to run this script. If your /bin/sh is +# noncompliant, but you have some other compliant shell such as ksh or +# bash, then to run this script, type that shell name before the whole +# command line, like: +# +# ksh Gradle +# +# Busybox and similar reduced shells will NOT work, because this script +# requires all of these POSIX shell features: +# * functions; +# * expansions «$var», «${var}», «${var:-default}», «${var+SET}», +# «${var#prefix}», «${var%suffix}», and «$( cmd )»; +# * compound commands having a testable exit status, especially «case»; +# * various built-in commands including «command», «set», and «ulimit». +# +# Important for patching: +# +# (2) This script targets any POSIX shell, so it avoids extensions provided +# by Bash, Ksh, etc; in particular arrays are avoided. +# +# The "traditional" practice of packing multiple parameters into a +# space-separated string is a well documented source of bugs and security +# problems, so this is (mostly) avoided, by progressively accumulating +# options in "$@", and eventually passing that to Java. +# +# Where the inherited environment variables (DEFAULT_JVM_OPTS, JAVA_OPTS, +# and GRADLE_OPTS) rely on word-splitting, this is performed explicitly; +# see the in-line comments for details. +# +# There are tweaks for specific operating systems such as AIX, CygWin, +# Darwin, MinGW, and NonStop. +# +# (3) This script is generated from the Groovy template +# https://github.com/gradle/gradle/blob/HEAD/subprojects/plugins/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt +# within the Gradle project. +# +# You can find Gradle at https://github.com/gradle/gradle/. +# +############################################################################## + +# Attempt to set APP_HOME + +# Resolve links: $0 may be a link +app_path=$0 + +# Need this for daisy-chained symlinks. +while + APP_HOME=${app_path%"${app_path##*/}"} # leaves a trailing /; empty if no leading path + [ -h "$app_path" ] +do + ls=$( ls -ld "$app_path" ) + link=${ls#*' -> '} + case $link in #( + /*) app_path=$link ;; #( + *) app_path=$APP_HOME$link ;; + esac +done + +# This is normally unused +# shellcheck disable=SC2034 +APP_BASE_NAME=${0##*/} +# Discard cd standard output in case $CDPATH is set (https://github.com/gradle/gradle/issues/25036) +APP_HOME=$( cd "${APP_HOME:-./}" > /dev/null && pwd -P ) || exit + +# Use the maximum available, or set MAX_FD != -1 to use that value. +MAX_FD=maximum + +warn () { + echo "$*" +} >&2 + +die () { + echo + echo "$*" + echo + exit 1 +} >&2 + +# OS specific support (must be 'true' or 'false'). +cygwin=false +msys=false +darwin=false +nonstop=false +case "$( uname )" in #( + CYGWIN* ) cygwin=true ;; #( + Darwin* ) darwin=true ;; #( + MSYS* | MINGW* ) msys=true ;; #( + NONSTOP* ) nonstop=true ;; +esac + +CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar + + +# Determine the Java command to use to start the JVM. +if [ -n "$JAVA_HOME" ] ; then + if [ -x "$JAVA_HOME/jre/sh/java" ] ; then + # IBM's JDK on AIX uses strange locations for the executables + JAVACMD=$JAVA_HOME/jre/sh/java + else + JAVACMD=$JAVA_HOME/bin/java + fi + if [ ! -x "$JAVACMD" ] ; then + die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME + +Please set the JAVA_HOME variable in your environment to match the +location of your Java installation." + fi +else + JAVACMD=java + if ! command -v java >/dev/null 2>&1 + then + die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. + +Please set the JAVA_HOME variable in your environment to match the +location of your Java installation." + fi +fi + +# Increase the maximum file descriptors if we can. +if ! "$cygwin" && ! "$darwin" && ! "$nonstop" ; then + case $MAX_FD in #( + max*) + # In POSIX sh, ulimit -H is undefined. That's why the result is checked to see if it worked. + # shellcheck disable=SC2039,SC3045 + MAX_FD=$( ulimit -H -n ) || + warn "Could not query maximum file descriptor limit" + esac + case $MAX_FD in #( + '' | soft) :;; #( + *) + # In POSIX sh, ulimit -n is undefined. That's why the result is checked to see if it worked. + # shellcheck disable=SC2039,SC3045 + ulimit -n "$MAX_FD" || + warn "Could not set maximum file descriptor limit to $MAX_FD" + esac +fi + +# Collect all arguments for the java command, stacking in reverse order: +# * args from the command line +# * the main class name +# * -classpath +# * -D...appname settings +# * --module-path (only if needed) +# * DEFAULT_JVM_OPTS, JAVA_OPTS, and GRADLE_OPTS environment variables. + +# For Cygwin or MSYS, switch paths to Windows format before running java +if "$cygwin" || "$msys" ; then + APP_HOME=$( cygpath --path --mixed "$APP_HOME" ) + CLASSPATH=$( cygpath --path --mixed "$CLASSPATH" ) + + JAVACMD=$( cygpath --unix "$JAVACMD" ) + + # Now convert the arguments - kludge to limit ourselves to /bin/sh + for arg do + if + case $arg in #( + -*) false ;; # don't mess with options #( + /?*) t=${arg#/} t=/${t%%/*} # looks like a POSIX filepath + [ -e "$t" ] ;; #( + *) false ;; + esac + then + arg=$( cygpath --path --ignore --mixed "$arg" ) + fi + # Roll the args list around exactly as many times as the number of + # args, so each arg winds up back in the position where it started, but + # possibly modified. + # + # NB: a `for` loop captures its iteration list before it begins, so + # changing the positional parameters here affects neither the number of + # iterations, nor the values presented in `arg`. + shift # remove old arg + set -- "$@" "$arg" # push replacement arg + done +fi + + +# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. +DEFAULT_JVM_OPTS='-Dfile.encoding=UTF-8 "-Xmx64m" "-Xms64m"' + +# Collect all arguments for the java command: +# * DEFAULT_JVM_OPTS, JAVA_OPTS, JAVA_OPTS, and optsEnvironmentVar are not allowed to contain shell fragments, +# and any embedded shellness will be escaped. +# * For example: A user cannot expect ${Hostname} to be expanded, as it is an environment variable and will be +# treated as '${Hostname}' itself on the command line. + +set -- \ + "-Dorg.gradle.appname=$APP_BASE_NAME" \ + -classpath "$CLASSPATH" \ + org.gradle.wrapper.GradleWrapperMain \ + "$@" + +# Stop when "xargs" is not available. +if ! command -v xargs >/dev/null 2>&1 +then + die "xargs is not available" +fi + +# Use "xargs" to parse quoted args. +# +# With -n1 it outputs one arg per line, with the quotes and backslashes removed. +# +# In Bash we could simply go: +# +# readarray ARGS < <( xargs -n1 <<<"$var" ) && +# set -- "${ARGS[@]}" "$@" +# +# but POSIX shell has neither arrays nor command substitution, so instead we +# post-process each arg (as a line of input to sed) to backslash-escape any +# character that might be a shell metacharacter, then use eval to reverse +# that process (while maintaining the separation between arguments), and wrap +# the whole thing up as a single "set" statement. +# +# This will of course break if any of these variables contains a newline or +# an unmatched quote. +# + +eval "set -- $( + printf '%s\n' "$DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS" | + xargs -n1 | + sed ' s~[^-[:alnum:]+,./:=@_]~\\&~g; ' | + tr '\n' ' ' + )" '"$@"' + +exec "$JAVACMD" "$@" diff --git a/android/gradlew.bat b/android/gradlew.bat new file mode 100644 index 000000000000..66f1aa792033 --- /dev/null +++ b/android/gradlew.bat @@ -0,0 +1,92 @@ +@rem +@rem Copyright 2015 the original author or authors. +@rem +@rem Licensed under the Apache License, Version 2.0 (the "License"); +@rem you may not use this file except in compliance with the License. +@rem You may obtain a copy of the License at +@rem +@rem https://www.apache.org/licenses/LICENSE-2.0 +@rem +@rem Unless required by applicable law or agreed to in writing, software +@rem distributed under the License is distributed on an "AS IS" BASIS, +@rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +@rem See the License for the specific language governing permissions and +@rem limitations under the License. +@rem + +@if "%DEBUG%"=="" @echo off +@rem ########################################################################## +@rem +@rem Gradle startup script for Windows +@rem +@rem ########################################################################## + +@rem Set local scope for the variables with windows NT shell +if "%OS%"=="Windows_NT" setlocal + +set DIRNAME=%~dp0 +if "%DIRNAME%"=="" set DIRNAME=. +@rem This is normally unused +set APP_BASE_NAME=%~n0 +set APP_HOME=%DIRNAME% + +@rem Resolve any "." and ".." in APP_HOME to make it shorter. +for %%i in ("%APP_HOME%") do set APP_HOME=%%~fi + +@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. +set DEFAULT_JVM_OPTS=-Dfile.encoding=UTF-8 "-Xmx64m" "-Xms64m" + +@rem Find java.exe +if defined JAVA_HOME goto findJavaFromJavaHome + +set JAVA_EXE=java.exe +%JAVA_EXE% -version >NUL 2>&1 +if %ERRORLEVEL% equ 0 goto execute + +echo. 1>&2 +echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. 1>&2 +echo. 1>&2 +echo Please set the JAVA_HOME variable in your environment to match the 1>&2 +echo location of your Java installation. 1>&2 + +goto fail + +:findJavaFromJavaHome +set JAVA_HOME=%JAVA_HOME:"=% +set JAVA_EXE=%JAVA_HOME%/bin/java.exe + +if exist "%JAVA_EXE%" goto execute + +echo. 1>&2 +echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% 1>&2 +echo. 1>&2 +echo Please set the JAVA_HOME variable in your environment to match the 1>&2 +echo location of your Java installation. 1>&2 + +goto fail + +:execute +@rem Setup the command line + +set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar + + +@rem Execute Gradle +"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %* + +:end +@rem End local scope for the variables with windows NT shell +if %ERRORLEVEL% equ 0 goto mainEnd + +:fail +rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of +rem the _cmd.exe /c_ return code! +set EXIT_CODE=%ERRORLEVEL% +if %EXIT_CODE% equ 0 set EXIT_CODE=1 +if not ""=="%GRADLE_EXIT_CONSOLE%" exit %EXIT_CODE% +exit /b %EXIT_CODE% + +:mainEnd +if "%OS%"=="Windows_NT" endlocal + +:omega diff --git a/android/res/drawable/splashscreen.xml b/android/res/drawable/splashscreen.xml new file mode 100644 index 000000000000..5860a17ae549 --- /dev/null +++ b/android/res/drawable/splashscreen.xml @@ -0,0 +1,11 @@ + + + + + + + + + + + diff --git a/android/res/values/apptheme.xml b/android/res/values/apptheme.xml new file mode 100644 index 000000000000..f39f6306d2a0 --- /dev/null +++ b/android/res/values/apptheme.xml @@ -0,0 +1,8 @@ + + + + diff --git a/android/res/values/libs.xml b/android/res/values/libs.xml new file mode 100644 index 000000000000..fe63866f7264 --- /dev/null +++ b/android/res/values/libs.xml @@ -0,0 +1,21 @@ + + + + + + + + + + + + + + + + + + + + + diff --git a/android/res/values/splashscreentheme.xml b/android/res/values/splashscreentheme.xml new file mode 100644 index 000000000000..53b3673d83f9 --- /dev/null +++ b/android/res/values/splashscreentheme.xml @@ -0,0 +1,6 @@ + + + + diff --git a/android/res/values/strings.xml b/android/res/values/strings.xml new file mode 100644 index 000000000000..9c5ad89af109 --- /dev/null +++ b/android/res/values/strings.xml @@ -0,0 +1,3 @@ + + + diff --git a/android/res/xml/device_filter.xml b/android/res/xml/device_filter.xml index 782fae8dd7e1..1165716a9181 100644 --- a/android/res/xml/device_filter.xml +++ b/android/res/xml/device_filter.xml @@ -3,4 +3,3 @@ - diff --git a/android/res/xml/network_security_config.xml b/android/res/xml/network_security_config.xml new file mode 100644 index 000000000000..c15c09cbf2d5 --- /dev/null +++ b/android/res/xml/network_security_config.xml @@ -0,0 +1,4 @@ + + + + diff --git a/android/res/xml/qtprovider_paths.xml b/android/res/xml/qtprovider_paths.xml new file mode 100644 index 000000000000..ae5b4b6074e7 --- /dev/null +++ b/android/res/xml/qtprovider_paths.xml @@ -0,0 +1,4 @@ + + + + diff --git a/android/src/org/mavlink/qgroundcontrol/QGCActivity.java b/android/src/org/mavlink/qgroundcontrol/QGCActivity.java index 3b23f3abcde0..1826e043acca 100644 --- a/android/src/org/mavlink/qgroundcontrol/QGCActivity.java +++ b/android/src/org/mavlink/qgroundcontrol/QGCActivity.java @@ -202,7 +202,11 @@ public void onCreate(Bundle savedInstanceState) filter.addAction(ACTION_USB_PERMISSION); filter.addAction(BluetoothDevice.ACTION_ACL_CONNECTED); filter.addAction(BluetoothDevice.ACTION_ACL_DISCONNECTED); - _instance.registerReceiver(_instance._usbReceiver, filter); + if(android.os.Build.VERSION.SDK_INT >= android.os.Build.VERSION_CODES.TIRAMISU) { + _instance.registerReceiver(_instance._usbReceiver, filter, RECEIVER_EXPORTED); + } else { + _instance.registerReceiver(_instance._usbReceiver, filter); + } // Create intent for usb permission request int intentFlags = 0; diff --git a/src/main.cc b/src/main.cc index 9d636be0afd2..0cfaed24f0fd 100644 --- a/src/main.cc +++ b/src/main.cc @@ -293,6 +293,7 @@ int main(int argc, char *argv[]) #ifdef Q_OS_ANDROID AndroidInterface::checkStoragePermissions(); + // QNativeInterface::QAndroidApplication::hideSplashScreen(333); #endif if (!app->_initForNormalAppBoot()) { return -1; diff --git a/tools/update_android_manifest_package.sh b/tools/update_android_manifest_package.sh deleted file mode 100755 index 10041f113ad1..000000000000 --- a/tools/update_android_manifest_package.sh +++ /dev/null @@ -1,7 +0,0 @@ -#!/usr/bin/env bash - -MANIFEST_FILE=android/AndroidManifest.xml - -echo "Adjusting package name for daily build" -QGC_PKG_NAME="org.mavlink.qgroundcontrolbeta" -sed -i -e 's/package *= *"[^"]*"/package="'$QGC_PKG_NAME'"/' $MANIFEST_FILE diff --git a/tools/update_android_version.sh b/tools/update_android_version.sh deleted file mode 100755 index 5819ac5f65a7..000000000000 --- a/tools/update_android_version.sh +++ /dev/null @@ -1,74 +0,0 @@ -#!/usr/bin/env bash - -# git tag is in the form vX.Y.Z for builds from tagged commit -# git tag is in the form vX.Y.Z-1234-gSHA for builds from non-tagged commit - -# Strip the 'v' from the beginning of the tag -VERSIONNAME=`git describe --always --tags | sed -e 's/^v//'` -echo "tag $VERSIONNAME" - -# Change all occurences of '-' in tag to '.' and separate into parts -IFS=. read major minor patch dev sha <<<"${VERSIONNAME//-/.}" -echo "major:$major minor:$minor patch:$patch dev:$dev sha:$sha" - -# Max Android version code is 2100000000. Version codes must increase with each release and the -# version codes for multiple apks for the same release must be unique and not collide as well. -# All of this makes it next to impossible to create a rational system of building a version code -# from a semantic version without imposing some strict restrictions. -if [ $major -gt 9 ]; then - echo "Error: Major version larger than 1 digit: $major" - exit 1 -fi -if [ $minor -gt 9 ]; then - echo "Error: Minor version larger than 1 digit: $minor" - exit 1 -fi -if [ $patch -gt 99 ]; then - echo "Error: Patch version larger than 2 digits: $patch" - exit 1 -fi -if [ $dev -gt 999 ]; then - echo "Error: Dev version larger than 3 digits: $dev" - exit 1 -fi - -# Version code format: BBMIPPDDD (B=Bitness, I=Minor) -VERSIONCODE=$(($major*1000000)) -VERSIONCODE=$(($(($minor*100000)) + $VERSIONCODE)) -VERSIONCODE=$(($(($patch*1000)) + $VERSIONCODE)) -VERSIONCODE=$(($(($dev)) + $VERSIONCODE)) - -# The 32 bit and 64 bit APKs each need there own version code unique version code -if [ "$1" = "32" ]; then - VERSIONCODE=34$VERSIONCODE -else - VERSIONCODE=66$VERSIONCODE -fi - -MANIFEST_FILE=android/AndroidManifest.xml - -# manifest package -if [ "$2" = "master" ]; then - echo "Adjusting package name for daily build" - QGC_PKG_NAME="org.mavlink.qgroundcontrolbeta" - sed -i -e 's/package *= *"[^"]*"/package="'$QGC_PKG_NAME'"/' $MANIFEST_FILE -fi - -# android:versionCode -if [ -n "$VERSIONCODE" ]; then - echo "Android versionCode: ${VERSIONCODE}" - sed -i -e "s/android:versionCode=\"[0-9][0-9]*\"/android:versionCode=\"$VERSIONCODE\"/" $MANIFEST_FILE -else - echo "Error: versionCode empty" - exit 1 -fi - -# android:versionName -if [ -n "$VERSIONNAME" ]; then - echo "Android versionName: ${VERSIONNAME}" - sed -i -e 's/versionName *= *"[^"]*"/versionName="'$VERSIONNAME'"/' $MANIFEST_FILE -else - echo "Error: versionName empty" - exit 1 -fi -