gpt4 book ai didi

java - ClassNotFoundException,怎么办?

转载 作者:太空宇宙 更新时间:2023-11-04 10:29:27 24 4
gpt4 key购买 nike

简单来说,我是一名学习JAVA/Android开发的学生。在学习类(class)时,错误不断出现,但我似乎找不到问题所在。

不断收到此错误:

05-04 12:50:18.569 6836-6836/com.lucianvibez.flashchatnewfirebase E/AndroidRuntime: FATAL EXCEPTION: main
Process: com.lucianvibez.flashchatnewfirebase, PID: 6836
java.lang.RuntimeException: Unable to instantiate activity ComponentInfo{com.lucianvibez.flashchatnewfirebase/com.online.lucianvibez.flashchatnewfirebase.LoginActivity}: java.lang.ClassNotFoundException: Didn't find class "com.online.lucianvibez.flashchatnewfirebase.LoginActivity" on path: DexPathList[[zip file "/data/app/com.lucianvibez.flashchatnewfirebase-1/base.apk", zip file "/data/app/com.lucianvibez.flashchatnewfirebase-1/split_lib_dependencies_apk.apk", zip file "/data/app/com.lucianvibez.flashchatnewfirebase-1/split_lib_slice_0_apk.apk", zip file "/data/app/com.lucianvibez.flashchatnewfirebase-1/split_lib_slice_1_apk.apk", zip file "/data/app/com.lucianvibez.flashchatnewfirebase-1/split_lib_slice_2_apk.apk", zip file "/data/app/com.lucianvibez.flashchatnewfirebase-1/split_lib_slice_3_apk.apk", zip file "/data/app/com.lucianvibez.flashchatnewfirebase-1/split_lib_slice_4_apk.apk", zip file "/data/app/com.lucianvibez.flashchatnewfirebase-1/split_lib_slice_5_apk.apk", zip file "/data/app/com.lucianvibez.flashchatnewfirebase-1/split_lib_slice_6_apk.apk", zip file "/data/app/com.lucianvibez.flashchatnewfirebase-1/split_lib_slice_7_apk.apk", zip file "/data/app/com.lucianvibez.flashchatnewfirebase-1/split_lib_slice_8_apk.apk", zip file "/data/app/com.lucianvibez.flashchatnewfirebase-1/split_lib_slice_9_apk.apk"],nativeLibraryDirectories=[/data/app/com.lucianvibez.flashchatnewfirebase-1/lib/x86, /system/lib, /vendor/lib]]
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2548)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2707)
at android.app.ActivityThread.-wrap12(ActivityThread.java)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1460)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:154)
at android.app.ActivityThread.main(ActivityThread.java:6077)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:865)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:755)
Caused by: java.lang.ClassNotFoundException: Didn't find class "com.online.lucianvibez.flashchatnewfirebase.LoginActivity" on path: DexPathList[[zip file "/data/app/com.lucianvibez.flashchatnewfirebase-1/base.apk", zip file "/data/app/com.lucianvibez.flashchatnewfirebase-1/split_lib_dependencies_apk.apk", zip file "/data/app/com.lucianvibez.flashchatnewfirebase-1/split_lib_slice_0_apk.apk", zip file "/data/app/com.lucianvibez.flashchatnewfirebase-1/split_lib_slice_1_apk.apk", zip file "/data/app/com.lucianvibez.flashchatnewfirebase-1/split_lib_slice_2_apk.apk", zip file "/data/app/com.lucianvibez.flashchatnewfirebase-1/split_lib_slice_3_apk.apk", zip file "/data/app/com.lucianvibez.flashchatnewfirebase-1/split_lib_slice_4_apk.apk", zip file "/data/app/com.lucianvibez.flashchatnewfirebase-1/split_lib_slice_5_apk.apk", zip file "/data/app/com.lucianvibez.flashchatnewfirebase-1/split_lib_slice_6_apk.apk", zip file "/data/app/com.lucianvibez.flashchatnewfirebase-1/split_lib_slice_7_apk.apk", zip file "/data/app/com.lucianvibez.flashchatnewfirebase-1/split_lib_slice_8_apk.apk", zip file "/data/app/com.lucianvibez.flashchatnewfirebase-1/split_lib_slice_9_apk.apk"],nativeLibraryDirectories=[/data/app/com.lucianvibez.flashchatnewfirebase-1/lib/x86, /system/lib, /vendor/lib]]

这是下面的应用程序模块 build.gradle 文件:

apply plugin: 'com.android.application'

android {
compileSdkVersion 27

defaultConfig {
applicationId "com.lucianvibez.flashchatnewfirebase"
minSdkVersion 16
targetSdkVersion 27
versionCode 1
versionName "1.0"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}

dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
testImplementation 'junit:junit:4.12'
implementation 'com.android.support:appcompat-v7:27.0.2'
implementation 'com.android.support:design:27.0.2'
implementation 'com.google.firebase:firebase-core:15.0.0'
implementation 'com.google.firebase:firebase-database:15.0.1'
implementation 'com.google.firebase:firebase-auth:15.1.0'



}

apply plugin: 'com.google.gms.google-services'

最佳答案

minSdkVersion 16您需要手动启用multidex支持。

这仅成为 API 级别 21 的默认设置。

android {
defaultConfig {
applicationId "com.lucianvibez.flashchatnewfirebase"
minSdkVersion 16
targetSdkVersion 27
versionCode 1
versionName "1.0"

multiDexEnabled true
}
...
}

以及依赖关系,因为 minSdkVersion< 21 :

dependencies {
implementation "com.android.support:multidex:1.0.3"
}

关于java - ClassNotFoundException,怎么办?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/50184314/

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