Android HTTP Architecture
| app | ||
| gradle/wrapper | ||
| .gitignore | ||
| build.gradle | ||
| gradle.properties | ||
| gradlew | ||
| gradlew.bat | ||
| README.md | ||
| settings.gradle | ||
Android HTTP Architecture
Android Studios project to open local HTML files in Chrome Custom Tab by hosting local HTTP server using NanoHTTPD.
User Requirements
- Android >= 7.0 (Nougat)
- 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
Android SDK
Android SDK (Software Development Kit) contains the required libraries and tools to build the APK
Install Android SDK
- Open Android Studio (for the first time after installation) and SDK installation will pop up.
- Select the installation directory for Andriod SDK.
- Click continue and accept to install Andriod SDK.
Install required SDK platform
- Open Android Studio
- In menu bar click,
Tools->SDK Manager. - A window will pop up with the list of Android versions available.
- To install any version, click the checkbox
☐near the Android Name and clickApply.- Select checkbox
☑ofAndroid 7.0 Nougatand clickApply.
- Select checkbox
- Upon successful installation, the
Statuswill be changed toInstalled.
Building APK
- Clone/Download this github repo
- Copy any webpage files (html, js, css, svg, images, etc) of your project to the
assetfolder (path:AndroidHttpArch/app/src/main/assets/)- AndroidHttpArch
- app
- src
- main
- assets
- main
- src
- app
- AndroidHttpArch
- Open
AndroidHttpArchfolder in Android Studio- In Android Studio menubar: Click
File->Open. Navigate and selectAndroidHttpArchfolder. ClickOk.
- In Android Studio menubar: Click
- 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.htmlorhome.htmlas starting homepage)
- Select Build variant
- Click
Build->Select Build Variant. TheBuild Variantpanel will open/pop-up - For
Module:app, selectActive Build Variantasrelease
- Click
- Build the project
- Click
Build->Make Project. (Default windows shortcut:Ctrl+F9).
- Click
- Wait for the build process to complete. (A pop up will appear at the bottom upon build completion)
- APK file will be generated in the
apkfolder. (path:AndroidHttpArch/app/build/outputs/apk/)- AndroidHttpArch
- app
- build
- outputs
- apk
- outputs
- build
- app
- AndroidHttpArch
The APK file can be distrubuted to users for installing in their Android devices.