How to create an APK from PWA?

20 Junio 2020 »
PWA

Prerequisites

  • Has PWA all ready Important!

  • Install llama pack dependencies

  • OpenJDK 8 Download and uncompress it on ~/.java/ directory

    tar xf ./openJDK-jdk.tar.gz -C ~/.java/
    tar xf ./openJDK-jre.tar.gz -C ~/.java/
    

    Optional Setup enviroment variable.

    echo "export JAVA_HOME=\"/home/luis/.java/OpenJDK8U-jdk_xxx/jdk8u242-xxx\" >> ~/.bashrc"
    

    Close all terminals for changes to take effect

  • Android command line tools Search section command line tools only Download and uncompress it on ~/Android/sdk/

    unzip ./commandlinetools-linux-xxxx_latest.zip -d ~/Android/sdk/
    
  • Install llama-pack cli

    npm i -g @llama-pack/cli
    

Execute llama-pack

Provide manifest.json url or manifest.webmanifest file

llama-pack init --manifest https://my-twa.com/manifest.webmanifest

Answer questions about twa

Domain being opened in the TWA:
Name of the application:

In keystore let’s press enter then it asks you about create a key store

First and Last names (eg: John Doe): Luis Reinoso
Organizational Unit (eg: Engineering Dept): Developer
Organization (eg: Company Name): Freenlance
Country (2 letter code): EC
// use the same password
Password for the Key Store: [hidden]
Password for the Key: [hidden]
  • Upload private key to google play console

  • Create asset link Using package fingerprint (SHA256) inside app sign go to Google Digital Asset Links

    You will need the App package fingerprint (SHA256), to get it search for API Integrity and App Signing.

This will create a json then create a file named assetlinks.json and serve it from https://my-twa.com/.well-known/assetlinks.json.

Useful Checker https://digitalassetlinks.googleapis.com/v1/statements:list?source.web.site=https://www.your-website-name.com&relation=delegate_permission/common.handle_all_urls

Build apk

llama-pack build

This generate the app-release-signed.apk

  • Upload to play store
  • Fill all data required from play store

References