AgentWeb is a powerful library based on Android WebView.
9,431
stars
969
commits
Java
primary language
Sep 14, 2026
updated
AgentWeb 是一个基于的 Android WebView ,极度容易使用以及功能强大的库,提供了 Android WebView 一系列的问题解决方案 ,并且轻量和极度灵活,详细使用请参照上面的 Sample 。
AgentWeb 通过 JitPack 分发,请先添加 JitPack 仓库:
allprojects {
repositories {
mavenCentral()
maven { url 'https://jitpack.io' }
}
}
Gradle 7+ 若使用 settings.gradle 集中管理仓库,则加在 dependencyResolutionManagement 中:
dependencyResolutionManagement {
repositories {
mavenCentral()
maven { url 'https://jitpack.io' }
}
}
Androidx
implementation 'com.github.Justson.AgentWeb:agentweb-core:5.1.7-androidx' // (必选)
implementation 'com.github.Justson.AgentWeb:agentweb-filechooser:5.1.7-androidx' // (可选)
implementation 'com.github.Justson:Downloader:v5.0.6-androidx' // (可选)
注意版本号不带
v前缀:Git tag 是v5.1.7-androidx,而 JitPack 在生成坐标时会去掉前导v,因此依赖里应写5.1.7-androidx。
AlertDialog 需要依赖 AppCompat 主题 。setAgentWebParent 不支持 ConstraintLayout 。mAgentWeb.getWebLifeCycle().onPause();会暂停应用内所有WebView 。minSdkVersion 低于等于16以下自定义WebView请注意与 JS 之间通信安全。compileSdk / targetSdk 升级到 36(Android 16),Android Gradle Plugin 升级到 8.13.2,请同步升级项目的 Gradle 与 AGP 版本。@JavascriptInterface 的 keep 规则,接入方无需再在自己的 proguard-rules.pro 中重复声明。setWebViewClient() / setWebChromeClient()。这会整体替换掉 AgentWeb 内部的实现,进度条、错误页、文件选择等功能都会随之失效。正确做法是使用 AgentWeb.with(...) 的 setWebViewClient() / setWebChromeClient(),或用 MiddlewareWebClientBase / MiddlewareWebChromeBase 中间件叠加。setOpenOtherPageWays(ASK) 只在目标 App 已安装时才会弹窗询问。未安装时系统中没有任何组件能处理该 scheme,不会弹窗,属预期行为。http/https 的 scheme 跳转时会调用 queryIntentActivities 判断能否唤起其他 App,应用市场的隐私检测可能将其识别为「读取已安装应用列表」。若无需唤起外部 App,设置 setOpenOtherPageWays(DefaultWebClient.OpenOtherPageWays.DISALLOW) 即可完全不触发该调用。开源不易,你的支持是我更新的动力。
Copyright (C) Justson(https://github.com/Justson/AgentWeb)
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
Java
100.0%
AgentWeb is a powerful library based on Android WebView.
9,431
stars
969
commits
Java
primary language
Sep 14, 2026
updated
AgentWeb 是一个基于的 Android WebView ,极度容易使用以及功能强大的库,提供了 Android WebView 一系列的问题解决方案 ,并且轻量和极度灵活,详细使用请参照上面的 Sample 。
AgentWeb 通过 JitPack 分发,请先添加 JitPack 仓库:
allprojects {
repositories {
mavenCentral()
maven { url 'https://jitpack.io' }
}
}
Gradle 7+ 若使用 settings.gradle 集中管理仓库,则加在 dependencyResolutionManagement 中:
dependencyResolutionManagement {
repositories {
mavenCentral()
maven { url 'https://jitpack.io' }
}
}
Androidx
implementation 'com.github.Justson.AgentWeb:agentweb-core:5.1.7-androidx' // (必选)
implementation 'com.github.Justson.AgentWeb:agentweb-filechooser:5.1.7-androidx' // (可选)
implementation 'com.github.Justson:Downloader:v5.0.6-androidx' // (可选)
注意版本号不带
v前缀:Git tag 是v5.1.7-androidx,而 JitPack 在生成坐标时会去掉前导v,因此依赖里应写5.1.7-androidx。
AlertDialog 需要依赖 AppCompat 主题 。setAgentWebParent 不支持 ConstraintLayout 。mAgentWeb.getWebLifeCycle().onPause();会暂停应用内所有WebView 。minSdkVersion 低于等于16以下自定义WebView请注意与 JS 之间通信安全。compileSdk / targetSdk 升级到 36(Android 16),Android Gradle Plugin 升级到 8.13.2,请同步升级项目的 Gradle 与 AGP 版本。@JavascriptInterface 的 keep 规则,接入方无需再在自己的 proguard-rules.pro 中重复声明。setWebViewClient() / setWebChromeClient()。这会整体替换掉 AgentWeb 内部的实现,进度条、错误页、文件选择等功能都会随之失效。正确做法是使用 AgentWeb.with(...) 的 setWebViewClient() / setWebChromeClient(),或用 MiddlewareWebClientBase / MiddlewareWebChromeBase 中间件叠加。setOpenOtherPageWays(ASK) 只在目标 App 已安装时才会弹窗询问。未安装时系统中没有任何组件能处理该 scheme,不会弹窗,属预期行为。http/https 的 scheme 跳转时会调用 queryIntentActivities 判断能否唤起其他 App,应用市场的隐私检测可能将其识别为「读取已安装应用列表」。若无需唤起外部 App,设置 setOpenOtherPageWays(DefaultWebClient.OpenOtherPageWays.DISALLOW) 即可完全不触发该调用。开源不易,你的支持是我更新的动力。
Copyright (C) Justson(https://github.com/Justson/AgentWeb)
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
Java
100.0%