Android: NoClassDefFoundError for some app users

后端 未结 2 1766
Happy的楠姐
Happy的楠姐 2020-12-20 05:44

I published an app 2 moths ago and sometimes, I am getting some errors from the users.

Here is the log:

java.lang.NoClassDefFoundError: android.os.St         


        
相关标签:
2条回答
  • 2020-12-20 06:00

    Strict Mode was introduced in API level 9, and you've got 8 set as your minimum in the manifest. These are probably from users running 2.2.x (API level 8).

    0 讨论(0)
  • 2020-12-20 06:11

    In Android below Gingerbread (API 9) StrictMode doesn't exists. So when importing the Library or using StrictMode code the Activity will throw an Exception.

    May be it works the following workaround helps (in PseudoCode):

    in Activity

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

    external Class (only here importing the strictmode lib)

    class StrictModeHelper{
      public static disable(){
      // do disable strict mode stuff
      }
    }
    
    0 讨论(0)
提交回复
热议问题