About this project
AgentWeb is an Android WebView-based library designed to simplify WebView usage, providing powerful and flexible features. It addresses common issues in Android WebView development, such as progress bars, error pages, file selection, and supports custom middleware.
## Key Features
- **Ease of Use**: Quick integration via `AgentWeb.with()` chained calls.
- **Rich Functionality**: Includes built-in progress bar, error page, file chooser (optional), downloader, etc.
- **Flexibility**: Supports middleware (MiddlewareWebClientBase / MiddlewareWebChromeBase) to stack custom logic.
- **Lightweight**: Core library is small, with optional modules imported as needed.
## Quick Start
1. Add the JitPack repository (configure in `settings.gradle` for Gradle 7+).
2. Add dependencies:
```groovy
implementation 'com.github.Justson.AgentWeb:agentweb-core:5.1.7-androidx' // Required
implementation 'com.github.Justson.AgentWeb:agentweb-filechooser:5.1.7-androidx' // Optional
implementation 'com.github.Justson:Downloader:v5.0.6-androidx' // Optional
```
3. Initialize in Activity/Fragment:
```java
AgentWeb.with(this)
.setAgentWebParent(container, new LinearLayout.LayoutParams(...))
.useDefaultIndicator()
.createAgentWeb()
.ready()
.go("https://example.com");
```
## Notes
- Do not call `setWebViewClient()` / `setWebChromeClient()` directly on the WebView; use AgentWeb's methods or middleware instead.
- `setOpenOtherPageWays(ASK)` only shows a dialog when the target app is installed.
- Handling non-http/https schemes may trigger privacy detection; set `DISALLOW` to avoid this.
- AppCompat theme is required for `AlertDialog` support.
- From v5.1.2, compileSdk/targetSdk upgraded to 36, requiring AGP updates.
- Since v5.1.3, keep rules for `@JavascriptInterface` are built-in; no need to redeclare.
## Related Projects
- [flying-pigeon](https://github.com/Justson/flying-pigeon): Cross-process IPC component.
- [AgentWebX5](https://github.com/Justson/AgentWebX5): Tencent X5 kernel adaptation.
- [CoolIndicator](https://github.com/Justson/CoolIndicator): WebView progress bar.
- [Downloader](https://github.com/Justson/Downloader): Lightweight file downloader.
## Documentation & Support
- [Wiki](https://github.com/Justson/AgentWeb/wiki) (incomplete)
- Sample examples (recommended)
- [Changelog](./releasenote.md)
- Issue feedback: [Issues](https://github.com/Justson/AgentWeb/issues)
- QQ Group: 599471474
## License
Apache License 2.0.
Comments
0 Rating appears after 10 ratings
Sign in to join the discussion.