【发布时间】:2026-01-25 23:45:02
【问题描述】:
我收到以下错误:
java.lang.RuntimeException:无法实例化活动 ComponentInfo{com..chat/com..login.LoginActivity}: java.lang.ClassNotFoundException:找不到类 路径上的“com..login.LoginActivity”:DexPathList[[zip 文件 "/data/app/com..chat-1/base.apk"],nativeLibraryDirectories=[/data/app/com.*.chat-1/lib/arm, /vendor/lib, /system/lib]]
我已经尝试了所有可以在网上找到的方法,但都没有成功。通过我制作的这个低效的脚本,我可以解决这个问题的唯一方法:
#!/usr/bin/env bash
./gradlew app:clean
./gradlew app:installDebug
./gradlew app:clean
./gradlew app:installDebug
/home/adel/Android/Sdk/platform-tools/adb shell am start -n com.*.chat/com.*.login.LoginActivity
notify-send -i icon.png "gradle task done" "check your phone"
它有效,但需要大约 7 分钟才能完成。有没有更快、更有效的方法?
【问题讨论】:
-
你为什么要两次调用相同的东西?为什么是通配符?
-
@DiegoTorresMilano 我不知道为什么,但如果我构建一旦我得到“ClassNotFoundException”异常,我发现调用相同的东西两次解决了这个问题......通配符因为我不想要人谷歌搜索应用名称以找到此问题
-
所以,先修复ClassNotFoundException问题。人们如何看待这个问题来给你一个应该猜测你用通配符隐藏包的答案?
-
是的,如果您发现问题是关于 ClassNotFoundException 的问题,我需要修复,在没有任何修改的情况下构建项目两次会使问题消失,去看看!
标签: java android gradle kotlin