Closed kamalpandey closed 2 years ago
which library version are you using ?
@Agontuk I am using version v5.3.0-beta.1
I got the same error from time to time in production app, v5.3.0-beta.1
.
trace from bugsnag:
java.lang.RuntimeException: Illegal callback invocation from native module. This callback type only permits a single invocation from native code.
at com.facebook.react.bridge.CallbackImpl.invoke(CallbackImpl.java:26)
at com.agontuk.RNFusedLocation.RNFusedLocationModule$1.onLocationError(RNFusedLocationModule.java:91)
at com.agontuk.RNFusedLocation.FusedLocationProvider$2.run(FusedLocationProvider.java:70)
at android.os.Handler.handleCallback(Handler.java:883)
at android.os.Handler.dispatchMessage(Handler.java:100)
at android.os.Looper.loop(Looper.java:241)
at android.app.ActivityThread.main(ActivityThread.java:7604)
at java.lang.reflect.Method.invoke(Method.java:-2)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:492)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:941)
Is there any way to reproduce this error ? If you can, please share an example project.
@Agontuk it’s totally random, I cannot reproduce it :(
One possibility would be that you're calling getCurrentPosition
inside a loop. Can you share how are you calling it ?
@kamalpandey I think this applies for you too.
@Agontuk I was using the example provided in repo.
@Agontuk I was using the example provided in repo.
unable to reproduce this on my end. Provide reproducible steps if you can.
@Agontuk Sorry it was random :(
It happens when you call every 5 seconds in Android wake lock and foreground service state. @Agontuk
10-26 23:11:43.560 10053 31809 31809 D IndicatorGardener: PhoneStatusBarView is done to update (IndicatorGardenModel) lp:96, lc:986, cc:416, rc:995, rp:96, h:96, ctm:false, ctms:0, cbms:0 10-26 23:11:43.565 10271 1922 1922 E AndroidRuntime: FATAL EXCEPTION: main 10-26 23:11:43.565 10271 1922 1922 E AndroidRuntime: Process: -, PID: 1922 10-26 23:11:43.565 10271 1922 1922 E AndroidRuntime: java.lang.RuntimeException: Illegal callback invocation from native module. This callback type only permits a single invocation from native code. 10-26 23:11:43.565 10271 1922 1922 E AndroidRuntime: at com.facebook.react.bridge.CallbackImpl.invoke(CallbackImpl.java:4) 10-26 23:11:43.565 10271 1922 1922 E AndroidRuntime: at com.agontuk.RNFusedLocation.RNFusedLocationModule$a.a(RNFusedLocationModule.java:1) 10-26 23:11:43.565 10271 1922 1922 E AndroidRuntime: at com.agontuk.RNFusedLocation.a$a.b(FusedLocationProvider.java:1) 10-26 23:11:43.565 10271 1922 1922 E AndroidRuntime: at d.f.a.c.f.h.m.a(Unknown Source:4) 10-26 23:11:43.565 10271 1922 1922 E AndroidRuntime: at com.google.android.gms.common.api.internal.j.d(com.google.android.gms:play-services-base@@17.5.0:3) 10-26 23:11:43.565 10271 1922 1922 E AndroidRuntime: at com.google.android.gms.common.api.internal.j$c.handleMessage(com.google.android.gms:play-services-base@@17.5.0:3) 10-26 23:11:43.565 10271 1922 1922 E AndroidRuntime: at android.os.Handler.dispatchMessage(Handler.java:107) 10-26 23:11:43.565 10271 1922 1922 E AndroidRuntime: at android.os.Looper.loop(Looper.java:237) 10-26 23:11:43.565 10271 1922 1922 E AndroidRuntime: at android.app.ActivityThread.main(ActivityThread.java:8167) 10-26 23:11:43.565 10271 1922 1922 E AndroidRuntime: at java.lang.reflect.Method.invoke(Native Method) 10-26 23:11:43.565 10271 1922 1922 E AndroidRuntime: at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:496) 10-26 23:11:43.565 10271 1922 1922 E AndroidRuntime: at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1100) 10-26 23:11:43.565 1000 956 1389 D LocationManagerService: request a24e5d0 gps Request[ACCURACY_FINE gps requested=+10s0ms fastest=+10s0ms] from com.google.android.gms(10083 foreground [whitelisted]) 10-26 23:11:43.565 1000 956 1389 D LocationManagerService: provider request: gps ProviderRequest[ON interval=+10s0ms] 10-26 23:11:43.566 1000 956 1389 I GnssLocationProvider: WakeLock acquired by sendMessage(SET_REQUEST, 0, com.android.server.location.GnssLocationProvider$GpsRequest@e9b69c9) 10-26 23:11:43.567 1000 956 1257 D GnssLocationProvider: setRequest ProviderRequest[ON interval=+10s0ms] 10-26 23:11:43.570 5013 1487 1541 E RequestManager_FLP: [LocationManager] Location request a24e5d0(Listener) gps interval=10000 from com.google.android.gms (10083 foreground) 10-26 23:11:43.572 1000 956 1257 D GnssLocationProvider: mStarted = false, mDisableGpsForPowerManager = false, isEnabled = true 10-26 23:11:43.574 1000 956 1389 I LocationManagerService: remove a24e5d0 10-26 23:11:43.574 1000 956 1257 D GnssLocationProvider: startNavigating
@jhui134 can you provide a sample repo that reproduces this ? Would be very helpful.
Did you manage to restore it? it happens to us very rarely as well..the scenario is not well understood.
@Agontuk It seems that we've seen this issue before #13 and was fixed then by wrapping the code in try-catch (https://github.com/Agontuk/react-native-geolocation-service/commit/158ebabec9b6c4c049953a21351eea2a6e9243d8). However, the latest code does not have the same try-catch blocks, removed during the rewrite (https://github.com/Agontuk/react-native-geolocation-service/commit/58a03622d20ea51062e7f1b923be99ab2d81809b) and causing a crash. Can we wrap the invoke inside a try-catch block? What would break if we were to do that?
The issue is hitting me as well: switching between a viro screen and a screen with getCurrentPosition...
Do you have any idea on what could fix it @Agontuk?
i am also getting this now in android, using v5.3.0-beta.4
Raised #338 , has fixed the issue for us.
Raised #338 , has fixed the issue for us.
It doesn't seem to be fully working (see the PR)
Hello guys, can you please try the latest changes from master branch ? I rewrote the location change listener logic, hopefully it'll solve the issue.
Hello guys, can you please try the latest changes from master branch ? I rewrote the location change listener logic, hopefully it'll solve the issue.
Actually, I'd like to try it. Could you make it a npm release? 🙏🏽
@francois-pasquier you can try npm install username/repo#master --save
, same goes with yarn add
(omit —save
ofcourse)
New version published, closing this.
ERROR Invariant Violation: No callback found with cbID 32337 and callID 16168 for RNFusedLocation.getCurrentPosition - most likely the callback was already invoked. Args: '[{"message":"Location request timed out.","code":3}]'