gpt4 book ai didi

java.lang.RuntimeException : Unable to instantiate application com. todos.MyApplication : java. lang.ClassNotFoundException 异常

转载 作者:行者123 更新时间:2023-11-30 06:08:42 25 4
gpt4 key购买 nike

W/dalvikvm(21732): threadid=1: thread exiting with uncaught exception (group=0x41d0cda0)
E/Drive.UninstallOperation( 1829): Package still installed com.todos
E/AndroidRuntime(21732): FATAL EXCEPTION: main
E/AndroidRuntime(21732): Process: com.todos, PID: 21732
E/AndroidRuntime(21732): java.lang.RuntimeException: Unable to instantiate application com.todos.MyApplication: java.lang.ClassNotFoundException: Didn't find class "com.todos.MyApplication" on path: DexPathList[[zip file "/data/app/com.todos-3.apk"],nativeLibraryDirectories=[/data/app-lib/com.todos-3, /vendor/lib, /system/lib]]
E/AndroidRuntime(21732): at android.app.LoadedApk.makeApplication(LoadedApk.java:507)
E/AndroidRuntime(21732): at android.app.ActivityThread.handleBindApplication(ActivityThread.java:4841)
E/AndroidRuntime(21732): at android.app.ActivityThread.access$1600(ActivityThread.java:174)
E/AndroidRuntime(21732): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1381)
E/AndroidRuntime(21732): at android.os.Handler.dispatchMessage(Handler.java:102)
E/AndroidRuntime(21732): at android.os.Looper.loop(Looper.java:146)
E/AndroidRuntime(21732): at android.app.ActivityThread.main(ActivityThread.java:5731)
E/AndroidRuntime(21732): at java.lang.reflect.Method.invokeNative(Native Method)
E/AndroidRuntime(21732): at java.lang.reflect.Method.invoke(Method.java:515)
E/AndroidRuntime(21732): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1291)
E/AndroidRuntime(21732): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1107)
E/AndroidRuntime(21732): at dalvik.system.NativeStart.main(Native Method)
E/AndroidRuntime(21732): Caused by: java.lang.ClassNotFoundException: Didn't find class "com.todos.MyApplication" on path: DexPathList[[zip file "/data/app/com.todos-3.apk"],nativeLibraryDirectories=[/data/app-lib/com.todos-3, /vendor/lib, /system/lib]]
E/AndroidRuntime(21732): at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:67)
E/AndroidRuntime(21732): at java.lang.ClassLoader.loadClass(ClassLoader.java:497)
E/AndroidRuntime(21732): at java.lang.ClassLoader.loadClass(ClassLoader.java:457)
E/AndroidRuntime(21732): at android.app.Instrumentation.newApplication(Instrumentation.java:981)
E/AndroidRuntime(21732): at android.app.LoadedApk.makeApplication(LoadedApk.java:502)
E/AndroidRuntime(21732): ... 11 more
W/ActivityManager( 757): Force finishing activity com.todos/.MainActivity
W/DropBoxManagerService( 757): Dropping: data_app_crash (1781 > 0 bytes)

我的 AndroidManifest 如下所示...

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

<uses-sdk
android:minSdkVersion="16"
android:targetSdkVersion="22" />

<application
android:allowBackup="true"
android:label="@string/app_name"
android:icon="@mipmap/ic_launcher"
android:theme="@style/AppTheme"
android:name="com.todos.MyApplication">


<meta-data android:name="com.facebook.sdk.ApplicationId" android:value="@string/facebook_app_id"/>

<activity
android:name=".MainActivity"
android:label="@string/app_name"
android:configChanges="keyboard|keyboardHidden|orientation|screenSize">
<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" />
</application>

当我添加 com.todos.MyApplication 源文件时,这开始中断...

enter image description here

当我在 Android Studio 中打开项目并导航到 MyApplication.java 时,我看到以下内容...

enter image description here

最佳答案

您是否仍然面临这个问题?

我已经通过安装干净的 apk 解决了这个问题:

  1. 首先卸载之前安装的APK。
  2. 然后运行以下命令:
cd android
./gradlew clean
react-native run-android

以上命令会先进入android文件夹,然后使用./gradlew clean清理文件夹,然后重建react-native run-android命令项目的根。

关于java.lang.RuntimeException : Unable to instantiate application com. todos.MyApplication : java. lang.ClassNotFoundException 异常,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/39382406/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com