A modern Android application built with Kotlin and Jetpack Compose that wraps any website in a WebView. Specifically optimized for WordPress-based education websites.
- Kotlin & Jetpack Compose: Modern Android development with declarative UI
- Wide SDK Support: Compatible with Android 5.0 (API 21) and above, covering ~99% of devices
- Responsive Design: Automatically adapts to all screen sizes (phones, tablets, foldables)
- WordPress Optimized: Full support for WordPress features including:
- JavaScript execution
- Cookies and session management
- LocalStorage
- File uploads and downloads
- Media playback
- Form submissions
- Easy Configuration: Change website URL in a single config file
- Offline Caching: Intelligent caching for better performance
- Back Button Support: Native Android back button navigates through web history
AdiClasses/
├── app/
│ ├── build.gradle.kts # App-level dependencies and config
│ ├── proguard-rules.pro # ProGuard configuration
│ └── src/
│ └── main/
│ ├── AndroidManifest.xml # App manifest with permissions
│ ├── java/com/yourcompany/webviewapp/
│ │ ├── MainActivity.kt # Main activity with WebView
│ │ └── ui/theme/ # Compose UI theme files
│ │ ├── Theme.kt
│ │ ├── Color.kt
│ │ └── Type.kt
│ └── res/
│ ├── values/
│ │ ├── config.xml # ⭐ CONFIGURATION FILE ⭐
│ │ └── themes.xml
│ └── xml/
│ ├── backup_rules.xml
│ └── data_extraction_rules.xml
├── build.gradle.kts # Project-level build config
├── settings.gradle.kts # Project settings
├── gradle.properties # Gradle properties
└── README.md # This file
Edit the configuration file at app/src/main/res/values/config.xml:
<?xml version="1.0" encoding="utf-8"?>
<resources>
<!-- Change this URL to your website -->
<string name="website_url">https://www.yourwebsite.com</string>
<!-- Change the app name -->
<string name="app_name">Your Education App</string>
<!-- Allow external links to open in WebView (true/false) -->
<bool name="allow_external_links">false</bool>
<!-- Enable file downloads (true/false) -->
<bool name="enable_downloads">true</bool>
</resources>To change the package name from com.yourcompany.webviewapp:
- Open
app/build.gradle.kts - Change
namespaceandapplicationIdto your desired package name - Update the package declaration in all
.ktfiles
Replace the default launcher icons:
- Place your app icon in
app/src/main/res/mipmap-*/ic_launcher.png - Or use Android Studio's Image Asset tool (Right-click
res→ New → Image Asset)
- Open the project folder in Android Studio
- Wait for Gradle sync to complete
- Click "Run" or press Shift+F10
# Debug build
./gradlew assembleDebug
# Release build (for production)
./gradlew assembleReleaseThe APK will be generated in:
- Debug:
app/build/outputs/apk/debug/app-debug.apk - Release:
app/build/outputs/apk/release/app-release.apk
- Android Studio Hedgehog (2023.1.1) or newer
- JDK 11 or newer
- Gradle 8.7+
- Minimum SDK: Android 5.0 (API 21)
- Target SDK: Android 15 (API 35)
- Device Coverage: ~99% of active Android devices
This app is specifically configured for WordPress websites with:
- JavaScript: Fully enabled for dynamic content
- Cookies: Persistent login sessions
- DOM Storage: LocalStorage and SessionStorage support
- File Uploads: Camera and gallery access for media uploads
- Downloads: Automatic file download handling
- Responsive Design: Viewport configuration for mobile optimization
- Mixed Content: Allows both HTTP and HTTPS resources
- Media Playback: Auto-play support for videos and audio
The app requests the following permissions:
INTERNET: Required for loading website contentACCESS_NETWORK_STATE: Check if device is onlineWRITE_EXTERNAL_STORAGE: File downloads (Android 9 and below only)CAMERA: For photo/video uploads through website formsREAD_MEDIA_IMAGES/VIDEO: Access media files on Android 13+
Set allow_external_links to:
false(recommended): Only URLs from your domain open in the apptrue: All links open in the WebView
Set enable_downloads to:
true(recommended): Users can download files from the websitefalse: Disable file downloads
Edit MainActivity.kt at line ~84 to customize:
- Zoom controls
- Cache behavior
- User agent string
- JavaScript settings
Edit app/src/main/java/com/yourcompany/webviewapp/ui/theme/Color.kt to customize app colors
- Create a new Activity for splash screen
- Set it as the launcher activity in AndroidManifest.xml
- Navigate to MainActivity after delay
- Check internet connection
- Verify URL in
config.xmlis correct and includeshttps:// - Check if website is accessible in a regular browser
- Ensure cookies are enabled (they are by default)
- Check if website uses third-party cookies
- Verify
enable_downloadsis set totruein config.xml - Check storage permissions are granted
- Ensure Android Download Manager is enabled
- The app uses responsive viewport settings by default
- Website should have responsive meta tags
- Test on different screen sizes
If you see an error like "Could not create parent directory for lock file" or Gradle cannot download:
Solution 1: Change Gradle User Home (Recommended)
- In Android Studio, go to File → Settings (or Ctrl+Alt+S)
- Navigate to Build, Execution, Deployment → Build Tools → Gradle
- Under "Gradle user home", change it to a directory where you have write permissions
- Example:
C:\Users\YourUsername\.gradle
- Example:
- Click Apply and OK
- Click File → Sync Project with Gradle Files
Solution 2: Run Android Studio as Administrator
- Close Android Studio
- Right-click on Android Studio icon
- Select "Run as administrator"
- Reopen the project
Solution 3: Set GRADLE_USER_HOME Environment Variable
- Open System Environment Variables
- Create new variable:
GRADLE_USER_HOME=C:\Users\YourUsername\.gradle - Restart Android Studio
- Generate Signing Key:
keytool -genkey -v -keystore my-release-key.keystore -alias my-key-alias -keyalg RSA -keysize 2048 -validity 10000- Configure Signing in
app/build.gradle.kts:
signingConfigs {
create("release") {
storeFile = file("my-release-key.keystore")
storePassword = "your-password"
keyAlias = "my-key-alias"
keyPassword = "your-password"
}
}- Build Release APK:
./gradlew assembleRelease- Build a signed release APK
- Create a Google Play Developer account ($25 one-time fee)
- Create a new app listing
- Upload the APK
- Fill in store listing details (description, screenshots, etc.)
- Submit for review
For issues or questions:
- Check the troubleshooting section
- Review Android WebView documentation
- Test website in mobile browser first
This is a template project. You can use it freely for your education website.
- Language: Kotlin 2.0.0
- UI Framework: Jetpack Compose
- Build System: Gradle 8.13 with Kotlin DSL
- Android Gradle Plugin: 8.13.1
- WebView Library: Accompanist WebView 0.34.0
- Material Design: Material 3 (Material You)
- Minimum API: 21 (Android 5.0 Lollipop)
- Target API: 34 (Android 14)
Created for educational website deployment with minimal development costs.