Skip to content
Snippets Groups Projects
Commit 8b019f44 authored by majou's avatar majou
Browse files

new apk builder

- doesn't require docker
- doesn't require manually updating version file
- generated apks can save to file
- supports android versions down to 5.1.1
- working debug builds that can be installed alongside release apk
parent 317b5dd4
No related branches found
No related tags found
1 merge request!14Update to 4.6.3
Showing
with 235 additions and 0 deletions
#
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you 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
#
# http://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.
.DS_Store
# Generated by package manager
node_modules/
# Generated by Cordova
/plugins/
/platforms/
# android sdk probably shouldn't go into our git
/androidsdk/
# generated apks
/dist/*
# temp folder
/tmp/
# generated automatically AND contains keystore's password, never include this into commits
build.json
# no idea what it's for
package-lock.json
# Generated by Cordova
/plugins/
/platforms/
cordova apk builder for primarily DoL
dependencies: (in parentheses are versions at the moment of writing)
- nodejs stable (20.10.0), with npm and npx installed
- gradle latest (8.5)
- openjdk 17 (Temurin-17.0.8.1+1)
- commandlinetools latest (10406996_latest) https://developer.android.com/studio#cmdline-tools scroll to the bottom of the page
to create a building environment, install nodejs, gradle and openjdk with your favorite package manager, then unzip and place `bin/`, `lib/`, and `source.properties` from commandlinetools archive into `androidsdk/cmdline-tools/latest`, then run ./setup_deps.sh. this only needs to be done once per repository.
debug builds are set up so they can be installed in parallel with release builds. to run debug build, run `./build_app_debug.sh`. compiled apk will be sent to the `../../dist/` directory.
release builds require official dol.keystore to sign the resulting apk. using any other keystore will make the app incompatible with official release.
in vast majority of cases, you'll be better off with a debug build, but if you're a mod dev and you really want your apk signed, then you can use the release build. first, you need to change `android-packageName` in `config.xml`, so it won't conflict with official app. second, generate a new keystore by running `keytool -genkey -v -keystore dol.keystore -alias dol -keyalg RSA -keysize 2048 -deststoretype pkcs12 -validity 9999` command, included with jdk. once done, place generated `dol.keystore` into `../../keys`.
after that, you can run `./build_app_release.sh`. it will ask for password to keystore. once the build is successful, you can uncomment the line in `./build_app_release.sh` to stop it from further asking for passwords. like with debug builds, compiled apks are sent to `../../dist`.
cordova apk builder for primarily DOL
# Installing dependencies
## nodejs latest
- download from https://nodejs.org/, ~25.4mb
- doesn't matter if it's LTS or latest
- options "npm package manager" and "Add to PATH" must be selected
- "Automatically install the necessary tools" is optional
## openjdk / temurin 17
- download the latest version of .msi installer for windows from https://adoptium.net/temurin/releases/?version=17&package=jdk&arch=x64, ~171mb
- when installing, choose to install "Set JAVA_HOME variable" option
## android commandline-tools latest
- download from https://developer.android.com/studio#cmdline-tools, links for tools-only are at the bottom of the page, ~146mb
- in the folder with this README, open androidsdk\cmdline-tools\latest, and extract "bin", "lib", and "source.properties" from the downloaded archive from the previous step into it. there should be no other sub-folders
## gradle 7.4.2
- download from https://gradle.org/next-steps/?version=7.4.2&format=bin, ~110mb
- extract the archive into `androidsdk/gradle`
## the rest
- once everything above is done, run `setup_deps.bat`
# Building the apk
## debug build
debug builds require no additional steps and can be installed in parallel with official app.
just run `build_app_debug.bat` batch file. compiled apk will appear in the dist folder.
## release build
if you have the official dol.keystore, run `build_app_debug.bat` batch file.
if you don't have one, stick to debug builds, they're not any less good.
bin/, lib/, source.properties, and NOTICE.txt from the cmdline-tools archive should go into this folder
if you're on windows, extract the gradle archive's bin/, lib/, etc. here
@echo off
SET "PATH=%PATH%;%CD%\androidsdk\commandline-tools\latest\bin;%CD%\androidsdk\gradle\bin"
SET "ANDROID_HOME=%CD%\androidsdk"
SET "ANDROID_SDK_ROOT=%ANDROID_HOME%"
IF NOT EXIST "..\..\Degrees of Lewdity.html" (
IF EXIST "..\..\Degrees of Lewdity VERSION.html" (
copy "..\..\Degrees of Lewdity VERSION.html" "..\..\Degrees of Lewdity.html"
) ELSE (
echo game is not compiled. make sure to run compile.bat first
pause
exit
)
)
@echo on
call node scripts/build_app.js
pause
#!/bin/sh
# set up the environment
ANDROID_HOME="$PWD/androidsdk/"
ANDROID_SDK_ROOT="$ANDROID_HOME"
ANDROID_PATH="$ANDROID_HOME/cmdline-tools/latest/bin"
PATH="./androidsdk/cmdline-tools/latest/bin:$PATH"
# run the build
node scripts/build_app.js
@echo off
SET "PATH=%PATH%;%CD%\androidsdk\commandline-tools\latest\bin;%CD%\androidsdk\gradle\bin"
SET "ANDROID_HOME=%CD%\androidsdk"
SET "ANDROID_SDK_ROOT=%ANDROID_HOME%"
IF NOT EXIST "..\..\Degrees of Lewdity.html" (
REM windows' compile.bat is dumb about versions
IF EXIST "..\..\Degrees of Lewdity VERSION.html" (
copy "..\..\Degrees of Lewdity VERSION.html" "..\..\Degrees of Lewdity.html"
) ELSE (
echo game is not compiled. make sure to run compile.bat first
pause
exit
)
)
REM uncomment the line below (remove "REM") to skip prompt for password when it's set correctly
REM SET SKIP_PASSWORD=true
SET BUILD_RELEASE=true
@echo on
call node scripts/build_app.js
pause
#!/bin/sh
# set up the environment
ANDROID_HOME="$PWD/androidsdk/"
ANDROID_SDK_ROOT="$ANDROID_HOME"
ANDROID_PATH="$ANDROID_HOME/cmdline-tools/latest/bin"
PATH="./androidsdk/cmdline-tools/latest/bin:$PATH"
# uncomment this flag to skip asking for password if the correct one is already stored in build.json
#export SKIP_PASSWORD=true
# run the build
export BUILD_RELEASE=true
node scripts/build_app.js
<?xml version='1.0' encoding='utf-8'?>
<widget
id="dol"
version="0.4.5.3"
xmlns="http://www.w3.org/ns/widgets"
xmlns:cdv="http://cordova.apache.org/ns/1.0"
android-packageName="com.vrelnir.DegreesOfLewdity"
>
<name short="DoL">Degrees of Lewdity</name>
<description>Degrees of Lewdity</description>
<author email="9096-Vrelnir@users.noreply.gitgud.io" href="https://gitgud.io/Vrelnir/degrees-of-lewdity">
Vrelnir
</author>
<content src="index.html" />
<platform name="android">
<!-- build scripts -->
<hook type="before_prepare" src="scripts/prevent_unnecessary_deletes.js" />
<hook type="before_compile" src="scripts/prepare_files.js" />
<hook type="after_compile" src="scripts/move_built_apks.js" />
<!-- splash screen -->
<preference name="AndroidWindowSplashScreenAnimatedIcon" value="res/splashscreen.png" />
<preference name="AndroidWindowSplashScreenBackground" value="#111111" />
<preference name="AndroidWindowSplashScreenIconBackgroundColor" value="#111111" />
<preference name="SplashScreenDelay" value="0" />
<!-- app icons -->
<icon src="res/icon-ldpi.png" density="ldpi" comment="36x36 px" />
<icon src="res/icon-mdpi.png" density="mdpi" comment="48x48 px" />
<icon src="res/icon-hdpi.png" density="hdpi" comment="72x72 px" />
<icon src="res/icon-xhdpi.png" density="xhdpi" comment="96x96 px" />
<icon src="res/icon-xxhdpi.png" density="xxhdpi" comment="144x144 px" />
<icon src="res/icon-xxxhdpi.png" density="xxxhdpi" comment="192x192 px" />
</platform>
</widget>
{
"name": "apk-builder",
"displayName": "built app",
"version": "1.0.0",
"description": "pack html games into a nice cordova app",
"main": "index.js",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
},
"keywords": [
"ecosystem:cordova"
],
"author": "majou",
"license": "you owe author a beer now.",
"dependencies": {
"cordova": "^12.0.0"
},
"cordova": {
"platforms": [
"android"
],
"plugins": {
"cordova-plugin-save-dialog": {},
"cordova-plugin-rnk-toast": {}
}
},
"devDependencies": {
"cordova-android": "11.0.x",
"cordova-plugin-rnk-toast": "^0.0.3",
"cordova-plugin-save-dialog": "^2.0.1"
}
}
\ No newline at end of file
devTools/apkbuilder/res/GooglePlayStore.png

15.5 KiB

devTools/apkbuilder/res/icon-hdpi.png

8.11 KiB

devTools/apkbuilder/res/icon-ldpi.png

3.14 KiB

devTools/apkbuilder/res/icon-mdpi.png

4.67 KiB

devTools/apkbuilder/res/icon-xhdpi.png

10.7 KiB

devTools/apkbuilder/res/icon-xxhdpi.png

14.5 KiB

devTools/apkbuilder/res/icon-xxxhdpi.png

12.4 KiB

#!/bin/sh
# convert source icon to appropriate sizes
if magick -version; then continue; else echo "this script requires image magick installed and in PATH"; fi;
magick icon.png -resize 192x192 icon-xxxhdpi.png
magick icon.png -resize 144x144 icon-xxhdpi.png
magick icon.png -resize 96x96 icon-xhdpi.png
magick icon.png -resize 72x72 icon-hdpi.png
magick icon.png -resize 48x48 icon-mdpi.png
magick icon.png -resize 36x36 icon-ldpi.png
devTools/apkbuilder/res/splashscreen.png

89 B

0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment