NoClassDefFoundError - Android 2.3.X

后端 未结 5 349
闹比i
闹比i 2021-01-07 09:40

I have a Task defined in a class. Fatal exception \"NoClassDefFoundError\" is happening on following line

MyCuteTask myTask = new MyCuteTask(equations)
         


        
5条回答
  •  傲寒
    傲寒 (楼主)
    2021-01-07 10:38

    Its an google play services issue. (https://code.google.com/p/android/issues/detail?id=81083)

    Workaround to avoid this crash till Google fixes it:

    Add following into your Application#onCreate() method

    try {
      Class.forName("android.os.AsyncTask");
    }
    catch(Throwable ignore) {
      // ignored
    }
    

    Note its Application#onCreate() and not Activity#onCreate()

    Update: I can verify that above changes fixed these crashes for me.

提交回复
热议问题