AndroidRuntime:致命异常:java.lang.RuntimeException:无法实例化活动 ComponentInfo 在路径上找不到类:DexPathList

问题描述 投票:0回答:1

我尝试在 android studio 中构建项目后打开应用程序。并看到这个致命错误! 我使用的是andrid studio 4 等级 6.1.1 并在 Pixel_3a_API_30_x86 上启动“应用程序”。 请帮我解决这个问题 我的构建工具版本是:28.0.3 minsdk版本是:16 编译版本和目标版本是:28

E/AndroidRuntime: FATAL EXCEPTION: main
    Process: com.Sz_kudak, PID: 10679
    java.lang.RuntimeException: Unable to instantiate activity ComponentInfo{com.Sz_kudak/com.Sz_kudak.MainActivity}: java.lang.ClassNotFoundException: Didn't find class "com.Sz_kudak.MainActivity" on path: DexPathList[[zip file "/data/app/~~UEHehGZ-MmZxWNQoPPwEFQ==/com.Sz_kudak-TcCaMriiPjl5FkhdO0g3MA==/base.apk"],nativeLibraryDirectories=[/data/app/~~UEHehGZ-MmZxWNQoPPwEFQ==/com.Sz_kudak-TcCaMriiPjl5FkhdO0g3MA==/lib/x86, /data/app/~~UEHehGZ-MmZxWNQoPPwEFQ==/com.Sz_kudak-TcCaMriiPjl5FkhdO0g3MA==/base.apk!/lib/x86, /system/lib, /system_ext/lib, /product/lib]]
        at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:3365)
        at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:3601)
        at android.app.servertransaction.LaunchActivityItem.execute(LaunchActivityItem.java:85)
        at android.app.servertransaction.TransactionExecutor.executeCallbacks(TransactionExecutor.java:135)
        at android.app.servertransaction.TransactionExecutor.execute(TransactionExecutor.java:95)
        at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2066)
        at android.os.Handler.dispatchMessage(Handler.java:106)
        at android.os.Looper.loop(Looper.java:223)
        at android.app.ActivityThread.main(ActivityThread.java:7656)
        at java.lang.reflect.Method.invoke(Native Method)
        at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:592)
        at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:947)
     Caused by: java.lang.ClassNotFoundException: Didn't find class "com.Sz_kudak.MainActivity" on path: DexPathList[[zip file "/data/app/~~UEHehGZ-MmZxWNQoPPwEFQ==/com.Sz_kudak-TcCaMriiPjl5FkhdO0g3MA==/base.apk"],nativeLibraryDirectories=[/data/app/~~UEHehGZ-MmZxWNQoPPwEFQ==/com.Sz_kudak-TcCaMriiPjl5FkhdO0g3MA==/lib/x86, /data/app/~~UEHehGZ-MmZxWNQoPPwEFQ==/com.Sz_kudak-TcCaMriiPjl5FkhdO0g3MA==/base.apk!/lib/x86, /system/lib, /system_ext/lib, /product/lib]]
        at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:207)
        at java.lang.ClassLoader.loadClass(ClassLoader.java:379)
        at java.lang.ClassLoader.loadClass(ClassLoader.java:312)
        at android.app.AppComponentFactory.instantiateActivity(AppComponentFactory.java:95)
        at androidx.core.app.CoreComponentFactory.instantiateActivity(CoreComponentFactory.java:45)
        at android.app.Instrumentation.newActivity(Instrumentation.java:1253)
        at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:3353)
        at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:3601) 
        at android.app.servertransaction.LaunchActivityItem.execute(LaunchActivityItem.java:85) 
        at android.app.servertransaction.TransactionExecutor.executeCallbacks(TransactionExecutor.java:135) 
        at android.app.servertransaction.TransactionExecutor.execute(TransactionExecutor.java:95) 
        at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2066) 
        at android.os.Handler.dispatchMessage(Handler.java:106) 
        at android.os.Looper.loop(Looper.java:223) 
        at android.app.ActivityThread.main(ActivityThread.java:7656) 
        at java.lang.reflect.Method.invoke(Native Method) 
        at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:592) 
        at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:947) 

我的安卓AndroidManifest.xml:

<manifest xmlns:android="http://schemas.android.com/apk/res/android"
          package="com.Sz_kudak">

    <uses-permission android:name="android.permission.INTERNET"/>

    <application
            android:name=".MainApplication"
            android:label="@string/app_name"
            android:icon="@mipmap/ic_launcher"
            android:roundIcon="@mipmap/ic_launcher_round"
            android:allowBackup="false"
            android:theme="@style/AppTheme"
            android:hardwareAccelerated="false"
            android:launchMode="singleTask">
        <activity
                android:name="com.Sz_kudak.MainActivity"
                android:label="@string/app_name"
                android:configChanges="keyboard|keyboardHidden|orientation|screenSize|uiMode"
                android:launchMode="singleTask"
                android:windowSoftInputMode="adjustResize">
            <intent-filter>
                <action android:name="android.intent.action.MAIN"/>
                <category android:name="android.intent.category.LAUNCHER"/>
            </intent-filter>
        </activity>
        <activity android:name="com.facebook.react.devsupport.DevSettingsActivity"/>
        <meta-data android:name="com.facebook.sdk.ApplicationId" android:value="@string/facebook_app_id"/>
    </application>

</manifest>
android react-native runtime java
1个回答
0
投票

检查您的 build.gradle 文件,可能存在不正确的命名空间,并且应用程序将无法启动

 android {
 namespace = "com.example"
 compileSdk flutter.compileSdkVersion
 ndkVersion flutter.ndkVersion
}
© www.soinside.com 2019 - 2024. All rights reserved.