在Android Studio(Windows版)中使用java.lang.NoClassDefFoundError: com.example.Fragments.SecondarySplashFragment
运行我的应用程序时,我收到了一个非常奇怪的错误,例如buildToolsVersion '23.0.1'
。这个错误对我来说似乎非常奇怪和新鲜,因为我只面对Android工作室的 Windows版本,但它在 Ubuntu版本中没有任何缺陷。在过去的两天里,我真的不知道该怎么做,完全坚持这个错误。任何类型的解决方案对我都有帮助。我也在下面发布我的完整logcat供您参考,如下所示。
java.lang.NoClassDefFoundError: com.example.Fragments.SecondarySplashFragment$1
10-31 12:45:01.561 26135-26135/com.example E/AndroidRuntime: at com.example.Fragments.SecondarySplashFragment.findViews(SecondarySplashFragment.java:71)
10-31 12:45:01.561 26135-26135/com.example E/AndroidRuntime: at com.example.Fragments.SecondarySplashFragment.onCreateView(SecondarySplashFragment.java:59)
10-31 12:45:01.561 26135-26135/com.example E/AndroidRuntime: at android.support.v4.app.Fragment.performCreateView(Fragment.java:1965)
10-31 12:45:01.561 26135-26135/com.example E/AndroidRuntime: at android.support.v4.app.FragmentManagerImpl.moveToState(FragmentManager.java:1078)
10-31 12:45:01.561 26135-26135/com.example E/AndroidRuntime: at android.support.v4.app.FragmentManagerImpl.moveToState(FragmentManager.java:1259)
10-31 12:45:01.561 26135-26135/com.example E/AndroidRuntime: at android.support.v4.app.BackStackRecord.run(BackStackRecord.java:738)
10-31 12:45:01.561 26135-26135/com.example E/AndroidRuntime: at android.support.v4.app.FragmentManagerImpl.execPendingActions(FragmentManager.java:1624)
10-31 12:45:01.561 26135-26135/com.example E/AndroidRuntime: at android.support.v4.app.FragmentController.execPendingActions(FragmentController.java:330)
10-31 12:45:01.561 26135-26135/com.example E/AndroidRuntime: at android.support.v4.app.FragmentActivity.onStart(FragmentActivity.java:547)
10-31 12:45:01.561 26135-26135/com.example E/AndroidRuntime: at android.app.Instrumentation.callActivityOnStart(Instrumentation.java:1177)
10-31 12:45:01.561 26135-26135/com.example E/AndroidRuntime: at android.app.Activity.performStart(Activity.java:5461)
10-31 12:45:01.561 26135-26135/com.example E/AndroidRuntime: at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2386)
10-31 12:45:01.561 26135-26135/com.example E/AndroidRuntime: at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2471)
10-31 12:45:01.561 26135-26135/com.example E/AndroidRuntime: at android.app.ActivityThread.access$900(ActivityThread.java:175)
10-31 12:45:01.561 26135-26135/com.example E/AndroidRuntime: at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1308)
10-31 12:45:01.561 26135-26135/com.example E/AndroidRuntime: at android.os.Handler.dispatchMessage(Handler.java:102)
10-31 12:45:01.561 26135-26135/com.example E/AndroidRuntime: at android.os.Looper.loop(Looper.java:146)
10-31 12:45:01.561 26135-26135/com.example E/AndroidRuntime: at android.app.ActivityThread.main(ActivityThread.java:5602)
10-31 12:45:01.561 26135-26135/com.example E/AndroidRuntime: at java.lang.reflect.Method.invokeNative(Native Method)
10-31 12:45:01.561 26135-26135/com.example E/AndroidRuntime: at java.lang.reflect.Method.invoke(Method.java:515)
10-31 12:45:01.561 26135-26135/com.example E/AndroidRuntime: at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1283)
10-31 12:45:01.561 26135-26135/com.example E/AndroidRuntime: at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1099)
10-31 12:45:01.561 26135-26135/com.example E/AndroidRuntime: at dalvik.system.NativeStart.main(Native Method)
的build.gradle
apply plugin: 'com.android.application'
android {
compileSdkVersion 23
buildToolsVersion '23.0.1'
useLibrary 'org.apache.http.legacy'
defaultConfig {
applicationId "com.example"
minSdkVersion 11
targetSdkVersion 23
versionCode 1
versionName "1.0"
multiDexEnabled true
}
dexOptions {
javaMaxHeapSize "4g"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
compile fileTree(include: ['*.jar'], dir: 'libs')
compile 'com.android.support:appcompat-v7:23.1.0'
compile 'com.google.android.gms:play-services:8.1.0'
compile 'com.google.code.gson:gson:2.4'
compile 'com.android.support:design:23.0.1'
compile 'com.android.support:cardview-v7:23.0.1'
compile files('libs/volley.jar')
compile 'com.github.bumptech.glide:glide:3.6.1'
compile 'com.android.support:recyclerview-v7:23.1.0'
}
注意:此问题仅发生在buildToolsVersion 23.0.1
但是如果我将其更改为buildToolsVersion 22.2.0
,一切正常,没有任何问题。
提前致谢。