我运行应用程序并突然收到此错误。虽然我的项目中包含所有文件仍然会给我以下错误。
错误日志:
E/AndroidRuntime: FATAL EXCEPTION: main
11-13 10:08:34.270 8938-8938/com.TCYonline.android.TCY_K12 E/AndroidRuntime: java.lang.NoClassDefFoundError: com.TCYonline.android.TCY_K12.fragments.TutorialFragment
11-13 10:08:34.270 8938-8938/com.TCYonline.android.TCY_K12 E/AndroidRuntime: at com.TCYonline.android.TCY_K12.adapters.TutorialPagerAdapter.<init>(TutorialPagerAdapter.java:52)
11-13 10:08:34.270 8938-8938/com.TCYonline.android.TCY_K12 E/AndroidRuntime: at com.TCYonline.android.TCY_K12.classes.TutorialActivity.onCreate(TutorialActivity.java:55)
11-13 10:08:34.270 8938-8938/com.TCYonline.android.TCY_K12 E/AndroidRuntime: at android.app.Activity.performCreate(Activity.java:5117)
11-13 10:08:34.270 8938-8938/com.TCYonline.android.TCY_K12 E/AndroidRuntime: at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1081)
11-13 10:08:34.270 8938-8938/com.TCYonline.android.TCY_K12 E/AndroidRuntime: at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2150)
11-13 10:08:34.270 8938-8938/com.TCYonline.android.TCY_K12 E/AndroidRuntime: at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2236)
11-13 10:08:34.270 8938-8938/com.TCYonline.android.TCY_K12 E/AndroidRuntime: at android.app.ActivityThread.access$600(ActivityThread.java:145)
11-13 10:08:34.270 8938-8938/com.TCYonline.android.TCY_K12 E/AndroidRuntime: at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1238)
11-13 10:08:34.270 8938-8938/com.TCYonline.android.TCY_K12 E/AndroidRuntime: at android.os.Handler.dispatchMessage(Handler.java:99)
11-13 10:08:34.270 8938-8938/com.TCYonline.android.TCY_K12 E/AndroidRuntime: at android.os.Looper.loop(Looper.java:137)
11-13 10:08:34.270 8938-8938/com.TCYonline.android.TCY_K12 E/AndroidRuntime: at android.app.ActivityThread.main(ActivityThread.java:5099)
11-13 10:08:34.270 8938-8938/com.TCYonline.android.TCY_K12 E/AndroidRuntime: at java.lang.reflect.Method.invokeNative(Native Method)
11-13 10:08:34.270 8938-8938/com.TCYonline.android.TCY_K12 E/AndroidRuntime: at java.lang.reflect.Method.invoke(Method.java:511)
11-13 10:08:34.270 8938-8938/com.TCYonline.android.TCY_K12 E/AndroidRuntime: at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:803)
11-13 10:08:34.270 8938-8938/com.TCYonline.android.TCY_K12 E/AndroidRuntime: at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:570)
11-13 10:08:34.270 8938-8938/com.TCYonline.android.TCY_K12 E/AndroidRuntime: at dalvik.system.NativeStart.main(Native Method)
11-13 10:08:38.134 8938-8938/com.TCYonline.android.TCY_K12 I/Process: Sending signal. PID: 8938 SIG: 9
我已经尝试过这些链接NoClassDefFoundError for .jar library at runtime in Android Studio
我的默认配置代码段如下:
defaultConfig {
applicationId "com.TCYonline.android.TCY_K12"
minSdkVersion 14
targetSdkVersion 23
versionCode 1
versionName "1.0"
multiDexEnabled true
}
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
compile 'com.android.support:appcompat-v7:23.1.0'
compile 'com.squareup.okhttp:okhttp:2.5.0'
compile 'com.android.support:multidex:1.0.0'
compile 'com.squareup.mimecraft:mimecraft:1.1.1'
compile 'com.android.support:recyclerview-v7:+'
compile 'com.google.android.gms:play-services:8.3.0'
compile 'com.android.support:design:23.1.0'
compile 'com.google.code.gson:gson:2.3.1'
compile 'com.facebook.android:facebook-android-sdk:4.0.0'
}
答案 0 :(得分:0)
将此添加到清单文件的应用程序标记中,这将解决问题
android:name="android.support.multidex.MultiDexApplication"