Getting NoClassDefFoundError: android.os.AsyncTask

后端 未结 3 1014
轮回少年
轮回少年 2020-12-10 04:48

This problem has been bothering me for a bit and I cannot find a satisfactory solution.

Many times (not always) in the creation of a specific object on the Android e

3条回答
  •  孤街浪徒
    2020-12-10 05:46

    OK, looks like it is a problem with one of the versions of Google play Services. See https://code.google.com/p/android/issues/detail?id=81083

    Looks like a work around might be to add:

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

    into your Application#onCreate()

    If you don't already have a Application class then create a class that extends from android.app.Application and

    1. Add the code above into its #onCreate()
    2. Add a reference to your application class in the application element of your AndroidManifest.
    
    

提交回复
热议问题