How to package apk for ionic3 Project

how ionic3 projects are packaged with apk

Mar.02,2021

there are two modes for downloading android platform
, one is debug, and the other is release
how to generate signature
how to sign automatically
-- optimized startup speed of prod
1. Add Android platform support
in the project directory to execute the ionic platform add android command
project path will automatically generate a platform folder, there is an android folder.
after adding Android platform support, you can package apk.
execute the ionic build android command under the project directory
will generate android-debug.apk
under xxxplatformsandroidbuildoutputsapk. The apk generated by this command is used for debugging.
install to the phone
Connect to the phone or open the simulator, open the command window under xxxplatformsandroidbuildoutputsapk and execute adb install android-debug.apk to install apk on the phone or simulator.
2. There are two packaged versions
, one is the debug debug version, and the other is the release release version

package debug debugger
the apk generated by executing ionic build android, under the project directory is the debug debug version
packaged release distribution
execute ionic build andorid under the project directory-- the apk generated by release, is the release release version.
if no signature file is configured, only android-release-unsigned.apk, unsigned apk is generated by default. The release version must have a signature to run on the phone.
3. Generate signature file
there are two ways to generate signature file
1. Use Android Studio

build.jpg
Genetate Signed APK.jpg
New Key Store.jpg
2. Generate signature files using jdk's KeyTool

Command to generate signature file:

keytool-genkey-v-keystore name.jks-alias alias_name-keyalg RSA-keysize 2048-validity 10000
name.jks,name can be customized. Jks is the suffix of the signature file generated by Android studio, and jks can be used by default here.
alias_name is alias and custom.

generate signature. Jpg
Note:
answer 'yes' in Chinese when asked whether it is correct, and at first foolishly answer 'yes'' results do not respond (answer'-') please answer please please

4. How to automatically sign when you package
create a new file named release-signing.properties in the project directory / platforms/android directory. The contents of the file are as follows

storeFile=path to keystore
keyAlias=your key alias
storePassword=your store password
keyPassword=you key password

compile with ionic build android--release, and a signed installation package android-release.apk will be generated under / platforms/android/build/outputs/apk

the path to the storeFile file under windows should use the directory delimiter / under Unix.

optimized package volume of 5.--prod
adding-prod at the end of the compilation command will speed up the startup of app.
ionic build android-- release-- prod
applies to both the debug version and the release version.

  • Open or download app from web

    window.location.href = "myscheme: myhost:8080 index"; window.setTimeout(function(){ window.location.href = "https: xxxx apk app.apk"; },2000); the above is Baidu s method, which can indeed open app, but wait a few seconds aft...

    Jul.10,2022
MySQL Query : SELECT * FROM `codeshelper`.`v9_news` WHERE status=99 AND catid='6' ORDER BY rand() LIMIT 5
MySQL Error : Disk full (/tmp/#sql-temptable-64f5-1e46d62-44beb.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
MySQL Errno : 1021
Message : Disk full (/tmp/#sql-temptable-64f5-1e46d62-44beb.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
Need Help?