Allow to install debug version without uninstalling release version on android
1
.gitignore
vendored
@ -60,6 +60,7 @@ android/bin
|
|||||||
android/build
|
android/build
|
||||||
android/libs
|
android/libs
|
||||||
android/obj
|
android/obj
|
||||||
|
android/res
|
||||||
android/.gradle
|
android/.gradle
|
||||||
android-*
|
android-*
|
||||||
*.apk
|
*.apk
|
||||||
|
BIN
android/icon-dbg.png
Normal file
After Width: | Height: | Size: 42 KiB |
Before Width: | Height: | Size: 37 KiB After Width: | Height: | Size: 37 KiB |
@ -36,6 +36,13 @@ export HOST_AARCH64=aarch64-linux-android
|
|||||||
export NDK_PLATFORM_AARCH64=android-21
|
export NDK_PLATFORM_AARCH64=android-21
|
||||||
export SDK_VERSION_AARCH64=21
|
export SDK_VERSION_AARCH64=21
|
||||||
|
|
||||||
|
export APP_NAME_RELEASE="SuperTuxKart"
|
||||||
|
export APP_NAME_DEBUG="SuperTuxKart Debug"
|
||||||
|
export PACKAGE_NAME_RELEASE="org.supertuxkart.stk"
|
||||||
|
export PACKAGE_NAME_DEBUG="org.supertuxkart.stk_dev"
|
||||||
|
export APP_ICON_RELEASE="$DIRNAME/icon.png"
|
||||||
|
export APP_ICON_DEBUG="$DIRNAME/icon-dbg.png"
|
||||||
|
|
||||||
|
|
||||||
# A helper function that checks if error ocurred
|
# A helper function that checks if error ocurred
|
||||||
check_error()
|
check_error()
|
||||||
@ -52,6 +59,7 @@ if [ ! -z "$1" ] && [ "$1" = "clean" ]; then
|
|||||||
rm -rf build
|
rm -rf build
|
||||||
rm -rf libs
|
rm -rf libs
|
||||||
rm -rf obj
|
rm -rf obj
|
||||||
|
rm -rf res
|
||||||
rm -rf .gradle
|
rm -rf .gradle
|
||||||
exit
|
exit
|
||||||
fi
|
fi
|
||||||
@ -108,10 +116,16 @@ if [ "$BUILD_TYPE" = "debug" ] || [ "$BUILD_TYPE" = "Debug" ]; then
|
|||||||
export ANT_BUILD_TYPE="debug"
|
export ANT_BUILD_TYPE="debug"
|
||||||
export GRADLE_BUILD_TYPE="assembleDebug"
|
export GRADLE_BUILD_TYPE="assembleDebug"
|
||||||
export IS_DEBUG_BUILD=1
|
export IS_DEBUG_BUILD=1
|
||||||
|
export APP_NAME="$APP_NAME_DEBUG"
|
||||||
|
export PACKAGE_NAME="$PACKAGE_NAME_DEBUG"
|
||||||
|
export APP_ICON="$APP_ICON_DEBUG"
|
||||||
elif [ "$BUILD_TYPE" = "release" ] || [ "$BUILD_TYPE" = "Release" ]; then
|
elif [ "$BUILD_TYPE" = "release" ] || [ "$BUILD_TYPE" = "Release" ]; then
|
||||||
export ANT_BUILD_TYPE="release"
|
export ANT_BUILD_TYPE="release"
|
||||||
export GRADLE_BUILD_TYPE="assembleRelease"
|
export GRADLE_BUILD_TYPE="assembleRelease"
|
||||||
export IS_DEBUG_BUILD=0
|
export IS_DEBUG_BUILD=0
|
||||||
|
export APP_NAME="$APP_NAME_RELEASE"
|
||||||
|
export PACKAGE_NAME="$PACKAGE_NAME_RELEASE"
|
||||||
|
export APP_ICON="$APP_ICON_RELEASE"
|
||||||
else
|
else
|
||||||
echo "Unsupported BUILD_TYPE: $BUILD_TYPE. Possible values are: " \
|
echo "Unsupported BUILD_TYPE: $BUILD_TYPE. Possible values are: " \
|
||||||
"debug, release"
|
"debug, release"
|
||||||
@ -342,8 +356,31 @@ check_error
|
|||||||
# Build apk
|
# Build apk
|
||||||
echo "Building APK"
|
echo "Building APK"
|
||||||
|
|
||||||
|
mkdir -p "$DIRNAME/res/drawable/"
|
||||||
|
mkdir -p "$DIRNAME/res/drawable-hdpi/"
|
||||||
|
mkdir -p "$DIRNAME/res/drawable-mdpi/"
|
||||||
|
mkdir -p "$DIRNAME/res/drawable-xhdpi/"
|
||||||
|
mkdir -p "$DIRNAME/res/drawable-xxhdpi/"
|
||||||
|
mkdir -p "$DIRNAME/res/values/"
|
||||||
|
|
||||||
|
STRINGS_FILE="$DIRNAME/res/values/strings.xml"
|
||||||
|
|
||||||
|
echo "<?xml version=\"1.0\" encoding=\"utf-8\"?>" > "$STRINGS_FILE"
|
||||||
|
echo "<resources>" >> "$STRINGS_FILE"
|
||||||
|
echo " <string name=\"app_name\">$APP_NAME</string>" >> "$STRINGS_FILE"
|
||||||
|
echo "</resources>" >> "$STRINGS_FILE"
|
||||||
|
|
||||||
sed -i "s/minSdkVersion=\".*\"/minSdkVersion=\"$SDK_VERSION\"/g" \
|
sed -i "s/minSdkVersion=\".*\"/minSdkVersion=\"$SDK_VERSION\"/g" \
|
||||||
"$DIRNAME/AndroidManifest.xml"
|
"$DIRNAME/AndroidManifest.xml"
|
||||||
|
|
||||||
|
sed -i "s/package=\".*\"/package=\"$PACKAGE_NAME\"/g" \
|
||||||
|
"$DIRNAME/AndroidManifest.xml"
|
||||||
|
|
||||||
|
cp "$APP_ICON" "$DIRNAME/res/drawable/icon.png"
|
||||||
|
convert -scale 72x72 "$APP_ICON" "$DIRNAME/res/drawable-hdpi/icon.png"
|
||||||
|
convert -scale 48x48 "$APP_ICON" "$DIRNAME/res/drawable-mdpi/icon.png"
|
||||||
|
convert -scale 96x96 "$APP_ICON" "$DIRNAME/res/drawable-xhdpi/icon.png"
|
||||||
|
convert -scale 144x144 "$APP_ICON" "$DIRNAME/res/drawable-xxhdpi/icon.png"
|
||||||
|
|
||||||
|
|
||||||
if [ "$BUILD_TOOL" = "gradle" ]; then
|
if [ "$BUILD_TOOL" = "gradle" ]; then
|
||||||
|
Before Width: | Height: | Size: 5.7 KiB |
Before Width: | Height: | Size: 3.1 KiB |
Before Width: | Height: | Size: 8.9 KiB |
Before Width: | Height: | Size: 17 KiB |
@ -1,4 +0,0 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
|
||||||
<resources>
|
|
||||||
<string name="app_name">SuperTuxKart</string>
|
|
||||||
</resources>
|
|