ParkSangGwon / TedPermission

Easy check permission library for Android Marshmallow
1.74k stars 240 forks source link

null object reference #57

Closed lixby closed 7 years ago

lixby commented 7 years ago

I encountered the following error on version 1.0.0.

  1. I look at the previous version of the user's question, there is a similar problem, this problem is the old version of the bug?
  2. This problem is in my application is occasional, the first installation start probability is relatively high.
  3. If it is your sdk problem, please reply to my explanation in that version of the solution.

Thank you, hope to reply as soon as possible.

Fatal Exception: java.lang.RuntimeException: Failure delivering result ResultInfo{who=@android:requestPermissions:, request=10, result=-1, data=Intent { act=android.content.pm.action.REQUEST_PERMISSIONS launchParam=MultiScreenLaunchParams { mDisplayId=0 mBaseDisplayId=0 mFlags=0 } (has extras) }} to activity {com.ion.Apollo/com.gun0912.tedpermission.TedPermissionActivity}: java.lang.RuntimeException: Could not dispatch event: class com.gun0912.tedpermission.busevent.TedPermissionEvent to handler [EventHandler public void com.gun0912.tedpermission.TedInstance.onPermissionResult(com.gun0912.tedpermission.busevent.TedPermissionEvent)]: Attempt to invoke interface method 'android.content.Context com.ion.Apollo.presenter.capture.CapturePresenter$View.getApplicationContext()' on a null object reference at android.app.ActivityThread.deliverResults(ActivityThread.java:4520) at android.app.ActivityThread.handleSendResult(ActivityThread.java:4563) at android.app.ActivityThread.-wrap22(ActivityThread.java) at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1698) at android.os.Handler.dispatchMessage(Handler.java:102) at android.os.Looper.loop(Looper.java:154) at android.app.ActivityThread.main(ActivityThread.java:6776) at java.lang.reflect.Method.invoke(Method.java) at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1520) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1410) Caused by java.lang.RuntimeException: Could not dispatch event: class com.gun0912.tedpermission.busevent.TedPermissionEvent to handler [EventHandler public void com.gun0912.tedpermission.TedInstance.onPermissionResult(com.gun0912.tedpermission.busevent.TedPermissionEvent)]: Attempt to invoke interface method 'android.content.Context com.ion.Apollo.presenter.capture.CapturePresenter$View.getApplicationContext()' on a null object reference at com.squareup.otto.Bus.throwRuntimeException(Bus.java:460) at com.squareup.otto.Bus.dispatch(Bus.java:387) at com.squareup.otto.Bus.dispatchQueuedEvents(Bus.java:368) at com.squareup.otto.Bus.post(Bus.java:337) at com.gun0912.tedpermission.busevent.TedBusProvider.post(TedBusProvider.java:49) at com.gun0912.tedpermission.TedPermissionActivity.permissionGranted(TedPermissionActivity.java:115) at com.gun0912.tedpermission.TedPermissionActivity.onRequestPermissionsResult(TedPermissionActivity.java:208) at android.app.Activity.dispatchRequestPermissionsResult(Activity.java:7460) at android.app.Activity.dispatchActivityResult(Activity.java:7286) at android.app.ActivityThread.deliverResults(ActivityThread.java:4516) at android.app.ActivityThread.handleSendResult(ActivityThread.java:4563) at android.app.ActivityThread.-wrap22(ActivityThread.java) at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1698) at android.os.Handler.dispatchMessage(Handler.java:102) at android.os.Looper.loop(Looper.java:154) at android.app.ActivityThread.main(ActivityThread.java:6776) at java.lang.reflect.Method.invoke(Method.java) at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1520) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1410) Caused by java.lang.NullPointerException: Attempt to invoke interface method 'android.content.Context com.ion.Apollo.presenter.capture.View.getApplicationContextCapturePresenter$()' on a null object reference at com.ion.Apollo.presenter.capture.CapturePresenterImpl.initLocation(CapturePresenterImpl.java:448) at com.ion.Apollo.presenter.capture.CapturePresenterImpl$1.onPermissionGranted(CapturePresenterImpl.java:425) at com.gun0912.tedpermission.TedInstance.onPermissionResult(TedInstance.java:67) at java.lang.reflect.Method.invoke(Method.java) at com.squareup.otto.EventHandler.handleEvent(EventHandler.java:89) at com.squareup.otto.Bus.dispatch(Bus.java:385) at com.squareup.otto.Bus.dispatchQueuedEvents(Bus.java:368) at com.squareup.otto.Bus.post(Bus.java:337) at com.gun0912.tedpermission.busevent.TedBusProvider.post(TedBusProvider.java:49) at com.gun0912.tedpermission.TedPermissionActivity.permissionGranted(TedPermissionActivity.java:115) at com.gun0912.tedpermission.TedPermissionActivity.onRequestPermissionsResult(TedPermissionActivity.java:208) at android.app.Activity.dispatchRequestPermissionsResult(Activity.java:7460) at android.app.Activity.dispatchActivityResult(Activity.java:7286) at android.app.ActivityThread.deliverResults(ActivityThread.java:4516) at android.app.ActivityThread.handleSendResult(ActivityThread.java:4563) at android.app.ActivityThread.-wrap22(ActivityThread.java) at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1698) at android.os.Handler.dispatchMessage(Handler.java:102) at android.os.Looper.loop(Looper.java:154) at android.app.ActivityThread.main(ActivityThread.java:6776) at java.lang.reflect.Method.invoke(Method.java) at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1520) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1410)

ParkSangGwon commented 7 years ago

If you use Proguard you have to set somthing. But you can use v2.0.0 with any setting. Please update version and read Readme

dependencies {
    compile 'gun0912.ted:tedpermission:2.0.0'
}
lixby commented 7 years ago

thanks!