Remove hardcoded android build settings and update to latest gradle
This commit is contained in:
parent
f0f498d53f
commit
76a08d9f30
@ -63,7 +63,7 @@ directory will have following structure:
|
||||
> ...
|
||||
|
||||
You also need Android SDK for android-26 platform or later (SDL2 requirement) and
|
||||
Android NDK. Version r22 is recommended, because it's known that it works
|
||||
Android NDK. Version r23 is recommended, because it's known that it works
|
||||
without issues. r24 or later is not compatible because it removes Android 4.1
|
||||
support (https://github.com/android/ndk/wiki/Changelog-r23#announcements)
|
||||
|
||||
@ -91,11 +91,18 @@ to just run:
|
||||
|
||||
export SDK_PATH=/path/to/your/android/sdk
|
||||
export NDK_PATH=/path/to/your/android/ndk
|
||||
# Optional for STK_MIN_ANDROID_SDK, STK_TARGET_ANDROID_SDK and STK_NDK_VERSION
|
||||
# If unset it will use the below values
|
||||
export STK_MIN_ANDROID_SDK=16
|
||||
export STK_TARGET_ANDROID_SDK=30
|
||||
export STK_NDK_VERSION=23.1.7779620
|
||||
./generate_assets.sh
|
||||
./make_deps.sh
|
||||
./make.sh
|
||||
|
||||
|
||||
You may need to add org.gradle.jvmargs=-XX:MaxHeapSize=2048m -Xmx2048m to
|
||||
.gradle/gradle.properties if you see java.lang.OutOfMemoryError / Java heap
|
||||
space execption error.
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
ENVIRONMENT VARIABLES
|
||||
@ -114,7 +121,8 @@ BUILD_TOOLS_VER - Allows to override the SDK build-tools version.
|
||||
|
||||
SDK_PATH - Path to SDK directory
|
||||
|
||||
NDK_PATH - Path to NDK directory
|
||||
NDK_PATH - Path to NDK directory, it should include a list of installed
|
||||
NDK version folders
|
||||
|
||||
PROJECT_VERSION - Set Supertuxkart version number, for example "0.9.3" or
|
||||
"git20170409" or whatever. The version must match with file
|
||||
|
@ -2,7 +2,7 @@ buildscript
|
||||
{
|
||||
repositories
|
||||
{
|
||||
jcenter()
|
||||
mavenCentral()
|
||||
google()
|
||||
}
|
||||
|
||||
@ -10,7 +10,8 @@ buildscript
|
||||
{
|
||||
// 4.1.2 is the minimum version to support native debug symbols file
|
||||
// https://developer.android.com/studio/build/shrink-code#android_gradle_plugin_version_41_or_later
|
||||
classpath 'com.android.tools.build:gradle:4.1.2'
|
||||
// 7.0.0 to fix https://stackoverflow.com/questions/68387270/android-studio-error-installed-build-tools-revision-31-0-0-is-corrupted
|
||||
classpath 'com.android.tools.build:gradle:7.0.0'
|
||||
}
|
||||
}
|
||||
|
||||
@ -18,7 +19,7 @@ allprojects
|
||||
{
|
||||
repositories
|
||||
{
|
||||
jcenter()
|
||||
mavenCentral()
|
||||
google()
|
||||
}
|
||||
}
|
||||
@ -27,8 +28,10 @@ apply plugin: 'com.android.application'
|
||||
|
||||
android
|
||||
{
|
||||
// buildToolsVersion is no longer needed https://developer.android.com/studio/releases/gradle-plugin.html#behavior_changes_1
|
||||
// Quote:
|
||||
// Build Tools 27.0.3 or higher. Keep in mind, you no longer need to specify a version for the build tools using the android.buildToolsVersion property—the plugin uses the minimum required version by default.
|
||||
compileSdkVersion compile_sdk_version.toInteger()
|
||||
buildToolsVersion build_tools_ver
|
||||
ndkVersion ndk_version
|
||||
externalNativeBuild
|
||||
{
|
||||
@ -40,13 +43,14 @@ android
|
||||
|
||||
defaultConfig
|
||||
{
|
||||
minSdkVersion 16
|
||||
targetSdkVersion 30
|
||||
minSdkVersion min_sdk_version.toInteger()
|
||||
targetSdkVersion target_sdk_version.toInteger()
|
||||
externalNativeBuild
|
||||
{
|
||||
ndkBuild
|
||||
{
|
||||
arguments 'APP_PLATFORM=android-16', 'APP_STL=c++_static', cpu_core
|
||||
def app_platform = "APP_PLATFORM=android-${min_sdk_version}"
|
||||
arguments app_platform, 'APP_STL=c++_static', cpu_core
|
||||
if (project.getProperty('compile_arch') == 'all')
|
||||
{
|
||||
abiFilters 'armeabi-v7a', 'arm64-v8a', 'x86', 'x86_64'
|
||||
|
@ -3,4 +3,4 @@ distributionBase=GRADLE_USER_HOME
|
||||
distributionPath=wrapper/dists
|
||||
zipStoreBase=GRADLE_USER_HOME
|
||||
zipStorePath=wrapper/dists
|
||||
distributionUrl=https\://services.gradle.org/distributions/gradle-6.5-all.zip
|
||||
distributionUrl=https\://services.gradle.org/distributions/gradle-7.3.3-all.zip
|
||||
|
@ -15,7 +15,17 @@ export NDK_BUILD_SCRIPT="$DIRNAME/Android.mk"
|
||||
#export NDK_CCACHE=ccache
|
||||
export CPU_CORE="-j$(($(nproc) + 1))"
|
||||
|
||||
export COMPILE_SDK_VERSION=30
|
||||
if [ -z "$STK_MIN_ANDROID_SDK" ]; then
|
||||
export STK_MIN_ANDROID_SDK=16
|
||||
fi
|
||||
|
||||
if [ -z "$STK_TARGET_ANDROID_SDK" ]; then
|
||||
export STK_TARGET_ANDROID_SDK=30
|
||||
fi
|
||||
|
||||
if [ -z "$STK_NDK_VERSION" ]; then
|
||||
export STK_NDK_VERSION=23.1.7779620
|
||||
fi
|
||||
|
||||
export APP_NAME_RELEASE="SuperTuxKart"
|
||||
export PACKAGE_NAME_RELEASE="org.supertuxkart.stk"
|
||||
@ -129,7 +139,7 @@ if [ -z "$SDK_PATH" ]; then
|
||||
export SDK_PATH="$SDK_PATH_DEFAULT"
|
||||
fi
|
||||
|
||||
NDK_PATH=$(realpath "$NDK_PATH")
|
||||
NDK_PATH="$(realpath "$NDK_PATH")/${STK_NDK_VERSION}"
|
||||
SDK_PATH=$(realpath "$SDK_PATH")
|
||||
|
||||
if [ ! -d "$NDK_PATH" ]; then
|
||||
@ -190,6 +200,9 @@ if [ -z "$BUILD_TOOLS_VER" ] || [ ! -d "$SDK_PATH/build-tools/$BUILD_TOOLS_VER"
|
||||
exit
|
||||
fi
|
||||
|
||||
BUILD_TOOLS_FULL=(${BUILD_TOOLS_VER//./ })
|
||||
export COMPILE_SDK_VERSION="${BUILD_TOOLS_FULL[0]}"
|
||||
|
||||
# Set project version and code
|
||||
if [ -f "$DIRNAME/obj/project_version" ]; then
|
||||
PROJECT_VERSION_PREV=$(cat "$DIRNAME/obj/project_version")
|
||||
@ -432,25 +445,27 @@ if [ -f "/usr/lib/jvm/java-8-openjdk-amd64/bin/java" ]; then
|
||||
fi
|
||||
|
||||
export ANDROID_HOME="$SDK_PATH"
|
||||
./gradlew -Pcompile_sdk_version=$COMPILE_SDK_VERSION \
|
||||
-Pbuild_tools_ver="$BUILD_TOOLS_VER" \
|
||||
-Pstorepass="$STK_STOREPASS" \
|
||||
-Pkeystore="$STK_KEYSTORE" \
|
||||
-Palias="$STK_ALIAS" \
|
||||
-Pndk_version="22.1.7171670" \
|
||||
-Pcompile_arch="$COMPILE_ARCH" \
|
||||
-Pcpu_core="$CPU_CORE" \
|
||||
./gradlew -Pcompile_sdk_version="$COMPILE_SDK_VERSION" \
|
||||
-Pmin_sdk_version="$STK_MIN_ANDROID_SDK" \
|
||||
-Ptarget_sdk_version="$STK_TARGET_ANDROID_SDK" \
|
||||
-Pstorepass="$STK_STOREPASS" \
|
||||
-Pkeystore="$STK_KEYSTORE" \
|
||||
-Palias="$STK_ALIAS" \
|
||||
-Pndk_version="$STK_NDK_VERSION" \
|
||||
-Pcompile_arch="$COMPILE_ARCH" \
|
||||
-Pcpu_core="$CPU_CORE" \
|
||||
$GRADLE_BUILD_TYPE
|
||||
|
||||
if [ "$GRADLE_BUILD_TYPE" = "assembleRelease" ]; then
|
||||
./gradlew -Pcompile_sdk_version=$COMPILE_SDK_VERSION \
|
||||
-Pbuild_tools_ver="$BUILD_TOOLS_VER" \
|
||||
-Pstorepass="$STK_STOREPASS" \
|
||||
-Pkeystore="$STK_KEYSTORE" \
|
||||
-Palias="$STK_ALIAS" \
|
||||
-Pndk_version="22.1.7171670" \
|
||||
-Pcompile_arch="$COMPILE_ARCH" \
|
||||
-Pcpu_core="$CPU_CORE" \
|
||||
./gradlew -Pcompile_sdk_version="$COMPILE_SDK_VERSION" \
|
||||
-Pmin_sdk_version="$STK_MIN_ANDROID_SDK" \
|
||||
-Ptarget_sdk_version="$STK_TARGET_ANDROID_SDK" \
|
||||
-Pstorepass="$STK_STOREPASS" \
|
||||
-Pkeystore="$STK_KEYSTORE" \
|
||||
-Palias="$STK_ALIAS" \
|
||||
-Pndk_version="$STK_NDK_VERSION" \
|
||||
-Pcompile_arch="$COMPILE_ARCH" \
|
||||
-Pcpu_core="$CPU_CORE" \
|
||||
"bundleRelease"
|
||||
fi
|
||||
|
||||
|
@ -39,7 +39,11 @@ if [ -z "$NDK_PATH" ]; then
|
||||
export NDK_PATH="$NDK_PATH_DEFAULT"
|
||||
fi
|
||||
|
||||
NDK_PATH=$(realpath "$NDK_PATH")
|
||||
if [ -z "$STK_NDK_VERSION" ]; then
|
||||
export STK_NDK_VERSION=23.1.7779620
|
||||
fi
|
||||
|
||||
NDK_PATH="$(realpath "$NDK_PATH")/${STK_NDK_VERSION}"
|
||||
if [ ! -d "$NDK_PATH" ]; then
|
||||
echo "Error: Couldn't find $NDK_PATH directory. Please create a symlink" \
|
||||
"to your Android NDK installation in the $NDK_PATH_DEFAULT or set" \
|
||||
|
Loading…
Reference in New Issue
Block a user