You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

如何解决Hilt应用类找不到的ClassNotFoundException问题

技术求助:ClassNotFoundException导致无法实例化Hilt应用类

我遇到了如下报错,求解决:
java.lang.RuntimeException: 无法实例化应用 com.example.bettehomes.MyAppHiltApp: java.lang.ClassNotFoundException: 在DexPathList路径上未找到类"com.example.bettehomes.BetteHomesHiltApp"

我的包名是com.example.bettehomes,已经尝试清理并重建项目,但问题仍存在。

AndroidManifest.xml 配置

<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
    package="com.example.bettehomes">

    <application
        android:icon="@mipmap/ic_launcher"
        android:label="@string/app_name"
        android:theme="@style/Theme.BetteHomes"
        android:name=".BetteHomesHiltApp"
        >
        <activity
            android:name=".BetteHomesActivity"
            android:exported="true"
            android:theme="@style/Theme.BetteHomes.NoActionBar">
            <intent-filter>
                <action android:name="android.intent.action.MAIN" />

                <category android:name="android.intent.category.LAUNCHER" />
            </intent-filter>
        </activity>
        <meta-data
            android:name="com.google.firebase.messaging.default_notification_icon"
            android:resource="@mipmap/ic_launcher" />
        <meta-data
            android:name="com.google.firebase.messaging.default_notification_color"
            android:resource="@color/dark_orange" />
        <meta-data
            android:name="com.google.firebase.messaging.default_notification_channel_id"
            android:value="@string/default_notification_channel_id" />
        <meta-data
            android:name="firebase_performance_logcat_enabled"
            android:value="true" />
    </application>
</manifest>

Logcat 日志详情

FATAL EXCEPTION: main 进程: com.example.bettehomes, PID: 27056
java.lang.RuntimeException: 无法实例化应用 com.example.bettehomes.BetteHomesHiltApp
java.lang.ClassNotFoundException: 在DexPathList路径上未找到类"com.example.bettehomes.BetteHomesHiltApp",路径详情:[zip文件 "/data/app/com.example.bettehomes-KuesyOEkKsRDfOrSY8aeXA==/base.apk"],本地库目录:[/data/app/com.example.bettehomes-KuesyOEkKsRDfOrSY8aeXA==/lib/arm64, /system/lib64, /system/product/lib64, /system/vendor/lib64]
at android.app.LoadedApk.makeApplication(LoadedApk.java:1090)
at android.app.ActivityThread.handleBindApplication(ActivityThread.java:6140)
at android.app.ActivityThread.access$1100(ActivityThread.java:208)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1696)
at android.os.Handler.dispatchMessage(Handler.java:106)
at android.os.Looper.loop(Looper.java:205)
at android.app.ActivityThread.main(ActivityThread.java:6991)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:493)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:884)

内容的提问来源于stack exchange,提问作者Kaleab Woldemariam

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.07.23 00:40:00