Android:某些应用用户的NoClassDefFoundError

时间:2012-06-21 07:27:04

标签: android

我在2个月之前发布了一个应用程序,有时候,我收到了一些用户的错误。

这是日志:

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个关于此问题的重复。

这是我的清单:

<?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" />

2 个答案:

答案 0 :(得分:5)

严格模式是在API级别9中引入的,并且您在清单中已将8个设置为最小值。这些可能来自运行2.2.x(API级别8)的用户。

答案 1 :(得分:1)

在Android下面的Gingerbread(API 9)StrictMode不存在。因此,在导入库或使用StrictMode代码时,Activity将抛出异常。

可能是以下解决方法有用(在PseudoCode中):

在活动中

if(9 >= android.os.Build.VERSION.SDK_INT){
StrictModeHelper.disable();
}

外部类(仅在此处导入strictmode lib)

class StrictModeHelper{
  public static disable(){
  // do disable strict mode stuff
  }
}