我有在商店发布的Android应用程序。在检查日志时,我发现了以下错误日志。
根据日志,GCMReceiver中似乎发生了错误,并且Mainapplication行190没有链接到GCM
它有一个代码getResources()。getString(R.string.density_bucket);
Fatal Exception: java.lang.RuntimeException: Unable to start receiver com.org.app.gcm.GcmReceiver: java.lang.RuntimeException: Unable to create application com.org.app.Application: java.lang.NullPointerException: Attempt to invoke virtual method 'java.lang.String android.content.res.Resources.getString(int)' on a null object reference
at android.app.ActivityThread.handleReceiver(ActivityThread.java:2955)
at android.app.ActivityThread.access$1800(ActivityThread.java:172)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1498)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:145)
at android.app.ActivityThread.main(ActivityThread.java:5835)
at java.lang.reflect.Method.invoke(Method.java)
at java.lang.reflect.Method.invoke(Method.java:372)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1388)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1183)
Caused by java.lang.RuntimeException: Unable to create application com.org.app.Application: java.lang.NullPointerException: Attempt to invoke virtual method 'java.lang.String android.content.res.Resources.getString(int)' on a null object reference
at android.app.LoadedApk.makeApplication(LoadedApk.java:638)
at android.app.ActivityThread.handleReceiver(ActivityThread.java:2935)
at android.app.ActivityThread.access$1800(ActivityThread.java:172)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1498)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:145)
at android.app.ActivityThread.main(ActivityThread.java:5835)
at java.lang.reflect.Method.invoke(Method.java)
at java.lang.reflect.Method.invoke(Method.java:372)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1388)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1183)
Caused by java.lang.NullPointerException: Attempt to invoke virtual method 'java.lang.String android.content.res.Resources.getString(int)' on a null object reference
at com.org.app.Application.onCreate(Application.java:190)
at android.app.Instrumentation.callApplicationOnCreate(Instrumentation.java:1020)
at android.app.LoadedApk.makeApplication(LoadedApk.java:635)
at android.app.ActivityThread.handleReceiver(ActivityThread.java:2935)
at android.app.ActivityThread.access$1800(ActivityThread.java:172)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1498)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:145)
at android.app.ActivityThread.main(ActivityThread.java:5835)
at java.lang.reflect.Method.invoke(Method.java)
at java.lang.reflect.Method.invoke(Method.java:372)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1388)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1183)