Google play services 5.0.77

前端 未结 10 1240
我寻月下人不归
我寻月下人不归 2021-01-30 04:23

From the 25th of june two unrelated apps that are using ads started to have this NPE

java.lang.NullPointerException
   at zo.a(SourceFile:172)
   at aeh.a(SourceF         


        
10条回答
  •  面向向阳花
    2021-01-30 04:47

    Found this solution by Mateusz Matela at https://groups.google.com/forum/#!topic/google-admob-ads-sdk/DkjtCx_Zvn8.

    I have tried on a Motorola DEFY+ that crashed from this bug two out of three times. It seems to work even when the warnings assositated with this bug appears in the log. It even says "AdWorker thread thrown an exception". My ads even reappeard when continuing to use the app.

    final UncaughtExceptionHandler defaultHandler = Thread.getDefaultUncaughtExceptionHandler();
    Thread.setDefaultUncaughtExceptionHandler(new UncaughtExceptionHandler() {
            @Override
            public void uncaughtException(Thread thread, Throwable ex) {
                if (thread.getName().startsWith("AdWorker")) {
                    Log.w("ADMOB", "AdWorker thread thrown an exception.", ex);
                } else if (defaultHandler != null) {
                    defaultHandler.uncaughtException(thread, ex);
                } else {
                    throw new RuntimeException("No default uncaught exception handler.", ex);
                }
            }
    });
    

提交回复
热议问题