fix: loadDataWithBaseURL→loadUrl file:// 直接加载缓存HTML

This commit is contained in:
LukeMackin
2026-07-21 19:55:22 +08:00
parent e39a250fbe
commit af799da3ea
4 changed files with 3 additions and 4 deletions

View File

@@ -1,2 +1,2 @@
#Tue Jul 21 15:13:59 CST 2026
#Tue Jul 21 19:20:43 CST 2026
gradle.version=8.13

View File

@@ -25,9 +25,8 @@ class MainActivity : AppCompatActivity() {
addJavascriptInterface(Bridge(this@MainActivity), "Android")
if (cacheFile.exists()) {
val html = cacheFile.readText()
loadDataWithBaseURL("https://gca.local/", html, "text/html", "UTF-8", null)
Log.i(TAG, "Loaded cached hot-update HTML (${html.length}B)")
loadUrl("file://" + cacheFile.absolutePath)
Log.i(TAG, "Loaded cached hot-update HTML (${cacheFile.length()}B)")
} else {
loadUrl("file:///android_asset/index.html")
Log.i(TAG, "Loaded embedded index.html")