Caused by: java.lang.ClassNotFoundException:
Didn't find class "android.view.fragment1" on path: DexPathList[[zip file "/data/app/com.jxust.jxthelp-2.apk"],nativeLibraryDirectories=[...]]
類 `android.view.fragment1` 未在 APK 或依賴庫中找到。 可能原因:
androidx.fragment:fragment 依賴。dependencies {
implementation "androidx.fragment:fragment:1.6.2" // 或較新版本
// 如果用舊 support library
// implementation "com.android.support:support-fragment:28.0.0"
}
Build → Clean Project → Rebuild Project。-keep class androidx.fragment.app.Fragment { *; }
-keep class android.app.Fragment { *; }
android {
defaultConfig {
multiDexEnabled true
}
}
dependencies {
implementation "androidx.multidex:multidex:2.0.1"
}
ClassNotFoundException: android.view.fragment1 本質是**類未打包進 APK**。優先檢查**類名拼寫**(應為 `Fragment`)及 **Fragment 依賴是否正確添加**,其次排查混淆、MultiDex 配置。