我在2個月前發佈了一個應用程序,有時候,我收到了來自用戶的一些錯誤。Android:NoClassDefFoundError對於某些應用程序用戶
這裏是日誌:
java.lang.NoClassDefFoundError: android.os.StrictMode$ThreadPolicy$Builder
at mdpi.android.MDPIActivity.onCreate(MDPIActivity.java:132)
at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1047)
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2627)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2679)
at android.app.ActivityThread.access$2300(ActivityThread.java:125)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2033)
at android.os.Handler.dispatchMessage(Handler.java:99)
at android.os.Looper.loop(Looper.java:123)
at android.app.ActivityThread.main(ActivityThread.java:4627)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:521)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:871)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:629)
at dalvik.system.NativeStart.main(Native Method)
奇怪的是,在測試時,我新收到此錯誤,並在那一刻,有大約這個問題的其他用戶6個repports。
這裏是我的清單:
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="mdpi.android"
android:versionCode="4"
android:versionName="2.1"
android:installLocation="auto">
<uses-sdk android:minSdkVersion="8" />
<application
android:icon="@drawable/app_icon"
android:label="@string/app_name"
android:theme="@android:style/Theme.Black">
android:debuggable=false
<activity
android:name=".WelcomeScreen"
android:configChanges="orientation|keyboardHidden"
android:label="@string/app_name" >
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity android:name=".MDPIActivity"
android:configChanges="keyboardHidden|orientation"></activity>
<activity android:name=".UserSubmission"
android:configChanges="orientation|keyboardHidden"></activity>
<activity android:name=".UserProfile"
android:configChanges="orientation|keyboardHidden"></activity>
<activity android:name=".UserInformations"
android:configChanges="orientation|keyboardHidden"></activity>
<activity android:name=".UserForgotPassword"
android:configChanges="orientation|keyboardHidden"></activity>
<activity android:name=".UserRegistration"
android:configChanges="orientation|keyboardHidden"></activity>
<activity android:name=".UserSubmissions"
android:configChanges="orientation|keyboardHidden"></activity>
<activity android:name=".UserSubmissionLog"
android:configChanges="orientation|keyboardHidden"></activity>
<activity android:name=".UserEmailNotifications"></activity>
<activity android:name=".Journals"
android:configChanges="keyboardHidden|orientation"></activity>
<activity android:name=".JournalsAdding"
android:configChanges="orientation|keyboardHidden"></activity>
<activity android:name=".JournalAimsAndScope"
android:configChanges="orientation|keyboardHidden"></activity>
<activity android:name=".JournalEditorialBoard"
android:configChanges="orientation|keyboardHidden"></activity>
<activity android:name=".JournalContact"
android:configChanges="orientation|keyboardHidden"></activity>
<activity android:name=".JournalArticles"
android:configChanges="orientation|keyboardHidden"></activity>
<activity android:name=".JournalArticleInfo"
android:configChanges="orientation|keyboardHidden"></activity>
<activity android:name=".JournalArticlesVolumeIssuesSelection"></activity>
<activity android:name=".MDPI_About"
android:configChanges="orientation|keyboardHidden"></activity>
<activity android:name=".MDPI_About_About"
android:configChanges="orientation|keyboardHidden"></activity>
<activity android:name=".MDPI_About_Contact"
android:configChanges="orientation|keyboardHidden"></activity>
<activity android:name=".User_Registration_Country_Choosing"></activity>
<activity android:name=".MDPI_About_OpenAccess"
android:configChanges="orientation|keyboardHidden"></activity>
<activity android:name=".UserLoging"
android:configChanges="keyboardHidden|orientation"></activity>
<activity
android:name=".JournalSelectingDialog"
android:theme="@android:style/Theme.Dialog"
android:configChanges="orientation|keyboardHidden"></activity>
<activity android:name=".UserProfileEditing"
android:configChanges="orientation|keyboardHidden"
android:windowSoftInputMode="stateHidden"></activity>
<activity android:name=".User_EditProfile_Country_Choosing"
android:configChanges="orientation|keyboardHidden">
</activity>
<activity android:name=".JournalsDeleting"
android:configChanges="orientation|keyboardHidden">
</activity>
<activity android:name=".Highlights"
android:configChanges="orientation|keyboardHidden">
</activity>
<activity android:name=".Highlights_News"
android:configChanges="orientation|keyboardHidden">
</activity>
<activity android:name=".Highlights_News_Informations"
android:configChanges="orientation|keyboardHidden">
</activity>
<activity android:name=".Highlights_NewSpecialIssues"
android:configChanges="orientation|keyboardHidden">
</activity>
<activity android:name=".Highlights_NewSpecialIssue_Informations"
android:configChanges="orientation|keyboardHidden">
</activity>
<activity android:name=".Search"
android:configChanges="orientation|keyboardHidden">
<intent-filter>
<action android:name="android.intent.action.SEARCH" />
</intent-filter>
<meta-data android:name="android.app.searchable"
android:resource="@xml/searchable"/>
</activity>
<activity android:name=".SearchInterface"
android:configChanges="orientation|keyboardHidden">
<meta-data android:name="android.app.default_searchable"
android:value=".Search" />
</activity>
<activity android:name=".SpecialIssueInformations"
android:configChanges="orientation|keyboardHidden">
</activity>
<activity android:name=".ArticlesFromAuthor"
android:configChanges="orientation|keyboardHidden">
</activity>
<activity android:name=".ChangeWallpaper"
android:configChanges="orientation|keyboardHidden">
</activity>
</application>
<uses-permission android:name="android.permission.INTERNET"></uses-permission>
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
看到這個[鏈接](http://stackoverflow.com/questions/8575617/i-dont-know-how-to-solve-android-os-networkonmainthreadexception)也 –
你應該發佈你的清單。你在你的應用中使用StrictMode.ThreadPolicy嗎?你在UI線程上做網絡嗎? –
謝謝@VivekKumarSrivastava,正常情況下,我在每個活動中都禁用嚴格模式。 –