Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

点击收藏或者历史记录后软件闪退 #12

Closed
Qing-Novel opened this issue Nov 3, 2024 · 10 comments
Closed

点击收藏或者历史记录后软件闪退 #12

Qing-Novel opened this issue Nov 3, 2024 · 10 comments

Comments

@Qing-Novel
Copy link

找人帮我抓了下报错

11-03 21:15:52.847 17311 17352 E AndroidRuntime: Process: net.deechael.esjzone, PID: 17311
11-03 21:15:52.847 17311 17352 E AndroidRuntime: at net.deechael.esjzone.novellibrary.component.ItemKt.analyseItems(Item.kt:41)
11-03 21:15:52.847 17311 17352 E AndroidRuntime: at net.deechael.esjzone.novellibrary.novel.NovelChapterListKt.analyseChapterList(NovelChapterList.kt:51)
11-03 21:15:52.847 17311 17352 E AndroidRuntime: at net.deechael.esjzone.network.features.GetNovelDetailKt.getNovelDetail(GetNovelDetail.kt:71)
11-03 21:15:52.847 17311 17352 E AndroidRuntime: at net.deechael.esjzone.ui.page.FavoritePage$Content$1$3$1$2$1.invokeSuspend(FavoritePage.kt:157)

说是这块

@Qing-Novel
Copy link
Author

系统是鸿蒙2和鸿蒙4.2

@Qing-Novel
Copy link
Author

帮我抓报错的人说是fmt写的有问题

@Qing-Novel
Copy link
Author

11-03 21:29:06.033 25407 25477 E AndroidRuntime: Process: net.deechael.esjzone, PID: 25407
11-03 21:29:06.033 25407 25477 E AndroidRuntime: at net.deechael.esjzone.novellibrary.component.ItemKt.analyseItems(Item.kt:41)
11-03 21:29:06.033 25407 25477 E AndroidRuntime: at net.deechael.esjzone.novellibrary.novel.NovelChapterListKt.analyseChapterList(NovelChapterList.kt:51)
11-03 21:29:06.033 25407 25477 E AndroidRuntime: at net.deechael.esjzone.network.features.GetNovelDetailKt.getNovelDetail(GetNovelDetail.kt:71)
11-03 21:29:06.033 25407 25477 E AndroidRuntime: at net.deechael.esjzone.ui.page.HistoryPage$Content$1$2$1$2$1.invokeSuspend(HistoryPage.kt:144)
11-03 21:29:06.110 2517 2997 E DollieAdapterService: notifyActivityState pkg:net.deechael.esjzone/net.deechael.esjzone.MainActivity state:20 fg:false mUid:10991

完整的报错,先点的收藏后点的历史记录

@Qing-Novel
Copy link
Author

getNovelDetail
说是这个函数调用了type和Author里面含有ul/li类标签

@Qing-Novel
Copy link
Author

可能就是这种表格在华为设备上不适配

@DeeChael
Copy link
Owner

DeeChael commented Nov 3, 2024

跟设备没关,可能是当时我没有遇见过有这种标签的小说所以没做检测适配

@Qing-Novel
Copy link
Author

跟设备没关,可能是当时我没有遇见过有这种标签的小说所以没做检测适配

那佬这个问题好修吗?

@Nihility-Protoss
Copy link

问题描述
我是辅助调试的人,注意到这个报错点是在
java/net/deechael/esjzone/network/features/GetNovelDetail.kt
fun EsjzoneClient.getNovelDetail(authorization: Authorization, novel: Novel): DetailedNovel

报错集中在
val Type: XPathEvaluator =
Xsoup.compile("/html/body/div[3]/section/div/div[1]/div[1]/div[2]/ul/li[1]/text()")

设备环境
Linux localhost 4.14.116 #1 SMP PREEMPT Fri Jul 8 19:05:33 CST 2022 aarch64
华为m6高能版8.6寸-安卓10
华为mate40pro-安卓12

报错日志
Qing-Novel的回复中所示
补充一段跟着其回复的报错
11-03 21:10:43.833 1591 1605 W ActivityTaskManager: finishTopCrashedActivityLocked Force finishing activity net.deechael.esjzone/.MainActivity 11-03 21:10:43.835 1591 1605 W HwActivityTaskManagerServiceEx: setResumedActivityUncheckLocked start call, from: ActivityRecord{46ea5c2 u0 net.deechael.esjzone/.MainActivity t201 f}, to: ActivityRecord{473f848 u0 com.huawei.android.launcher/.unihome.UniHomeLauncher t1} 11-03 21:10:43.836 1591 1605 W HwActivityTaskManagerServiceEx: appSwitch from: net.deechael.esjzone to: com.huawei.android.launcher

问题来源猜测
分析上下文怀疑是华为设备在UI上没有适配ul、li两个标签

@DeeChael
Copy link
Owner

DeeChael commented Nov 3, 2024

以及这个项目我已经没有经历继续维护了,这只是我用来学习安卓开发及 compose 的项目之一,我到现在也没学完但也没准备学了
在仓颉语言发布正式版之后,如果 API 完整可以在不使用 ArkTS 的情况下完成所有开发,我会开发支持 HarmonyOS NEXT 也就是 HarmonyOS 5.0 之后的鸿蒙原生应用当做鸿蒙开发学习用的练手软件,但我这次看了鸿蒙开发的设计指南,如果要做肯定会比这个项目好,有需要可以期待一下
主要是因为我自己的 mate60 升级了 next,我做这些软件主要是自己需要用

@Nihility-Protoss
Copy link

Nihility-Protoss commented Nov 3, 2024

解决思路
type和author的fmt有问题,那就直接不解析这两项了,直接用固定字符串替换
然后注意到下面还有个报错,修改思路是多做个空List判断,空List就返回固定字符串

解决方案

java/net/deechael/esjzone/network/features/GetNovelDetail.kt

71  //    val type = EsjzoneXPaths.Detail.Type.evaluate(document).get()
72  //    val author = EsjzoneXPaths.Detail.Author.evaluate(document).get()
79 "type",
80 "author",

java/net/deechael/esjzone/novellibrary/component/Item.kt

41  +           val a1 = if (analyseParagraph(child).isEmpty())
 +               TextComponent("Empty text")
 +          else
 +               analyseParagraph(child)[0] as TextComponent
 +           items.add(TextItem(a1))

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants