From 39f396a0f8c956f77f20af684c4ab6523ed36788 Mon Sep 17 00:00:00 2001 From: Sai Raj <39055732+sairajzero@users.noreply.github.com> Date: Thu, 16 Feb 2023 01:49:32 +0530 Subject: [PATCH] Update README.md --- README.md | 60 +++++++++++++++++++++++++++++++++++++++++++++++++++++-- 1 file changed, 58 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 9bb69f3..c1f7ff2 100644 --- a/README.md +++ b/README.md @@ -2,7 +2,63 @@ Android Studios project to open local HTML files in Chrome Custom Tab by hosting local HTTP server using NanoHTTPD. -### Requirements +### User Requirements - Android >= 7.0 (Nougat) -- Minimum API level : 24 - Android Chrome browser app + +## Prerequisite + +### Android Studio +Android Studio is required for building the APK from the source code +- Download and Install Android Studio from the official [site](https://developer.android.com/studio) + +### Android SDK +Android SDK (Software Development Kit) contains the required libraries and tools to build the APK + +#### Install Android SDK +1. Open Android Studio (for the first time after installation) and SDK installation will pop up. +2. Select the installation directory for Andriod SDK. +3. Click continue and accept to install Andriod SDK. + +#### Install required SDK platform +1. Open Android Studio +2. In menu bar click, `Tools` -> `SDK Manager`. +3. A window will pop up with the list of Android versions available. +4. To install any version, click the checkbox `☐` near the Android Name and click `Apply`. + - Select checkbox `☑` of `Android 7.0 Nougat` and click `Apply`. +5. Upon successful installation, the `Status` will be changed to `Installed`. + +## Building APK + +1. Clone [this](https://github.com/sairajzero/AndroidHttpArch) github repo +``` +git clone https://github.com/sairajzero/AndroidHttpArch.git +``` +2. Copy any webpage files (html, js, css, svg, images, etc) of your project to the `asset` folder (path: `AndroidHttpArch/app/src/main/assets/`) + - AndroidHttpArch + - app + - src + - main + - assets +``` +cp path-to-your-project/* AndroidHttpArch/app/src/main/assets +``` +3. Open `AndroidHttpArch` folder in Android Studio + - In Android Studio menubar: Click `File` -> `Open`. Navigate and select `AndroidHttpArch` folder. Click `Ok`. +4. Edit port and home page in `MainActivity.java`. (path: `AndroidHttpArch/app/src/main/java/com/ranchimall/androidhttparch/MainActivity.java`) + - Line 16: Edit port (for local hosting). + - Line 17: Edit the starting home page link. (Most projects have `index.html` or `home.html` as starting homepage) +5. Select Build variant + - Click `Build` -> `Select Build Variant`. The `Build Variant` panel will open/pop-up + - For `Module`: `app`, select `Active Build Variant` as `release` +5. Build the project + - Click `Build` -> `Make Project`. (Default windows shortcut: `Ctrl`+`F9`). +6. Wait for the build process to complete. (A pop up will appear at the bottom upon build completion) +7. APK file will be generated in the `apk` folder. (path: `AndroidHttpArch/app/build/outputs/apk/`) + - AndroidHttpArch + - app + - build + - outputs + - apk + +The APK file can be distrubuted to users for installing in their Android devices.